Skip to main content
Version: 1.5.0

ApisixRoute/v2beta3 Reference

Spec#

Meaning of each field in the spec of ApisixRoute are followed, the top level fields (apiVersion, kind and metadata) are same as other Kubernetes Resources.

FieldTypeDescription
httparrayApisixRoute's HTTP route rules.
http[].namestring (required)The route rule name.
http[].priorityintegerThe route priority, it's used to determine which route will be hitted when multile routes contains the same URI. Large number means higher priority.
http[].matchobjectRoute match conditions.
http[].match.pathsarrayA series of URI that should be matched (oneof) to use this route rule.
http[].match.hostsarrayA series of hosts that should be matched (oneof) to use this route rule.
http[].match.methodsarrayA series of HTTP methods(GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, CONNECT, TRACE) that should be matched (oneof) to use this route rule.
http[].match.remoteAddrsarrayA series of IP address (CIDR format) that should be matched (oneof) to use this route rule.
http[].match.exprsarrayA series expressions that the results should be matched (oneof) to use this route rule.
http[].match.exprs[].subjectobjectExpression subject.
http[].match.exprs[].subject.scopestringSpecify where to find the subject, values can be Header, Query, Cookie and Path.
http[].match.exprs[].subject.namestringSpecify subject name, when scope is Path, this field can be absent.
http[].match.exprs[].opstringExpression operator, see Expression Operators for the detail of enumerations.
http[].match.exprs[].valuestringExpected expression result, it's exclusive with http[].match.exprs[].set.
http[].match.exprs[].setarrayExpected expression result set, only used when the operator is In or NotIn, it's exclusive with http[].match.exprs[].value.
http[].backendsobjectThe backend services. When the number of backends more than one, weight based traffic split policy will be applied to shifting traffic between these backends.
http[].backends[].serviceNamestringThe backend service name, note the service and ApisixRoute should be created in the same namespace. Cross namespace referencing is not allowed.
http[].backends[].servicePortinteger or stringThe backend service port, can be the port number or the name defined in the service object.
http[].backends[].resolveGranularitystringSee Service Resolve Granularity for the details.
http[].backends[].weightintThe backend weight, which is critical when shifting traffic between multiple backends, default is 100. Weight is ignored when there is only one backend.
http[].backends[].subsetstringSubset specifies a subset for the target Service. The subset should be pre-definedin ApisixUpstream about this service.
http[].pluginsarrayA series of APISIX plugins that will be executed once this route rule is matched
http[].plugins[].namestringThe plugin name, see docs for learning the available plugins.
http[].plugins[].enablebooleanWhether the plugin would be used
http[].plugins[].configobjectThe configuration of the plugin that must have the same fields as in APISIX.
http[].websocketbooleanWhether enable websocket proxy.
streamarrayApisixRoutes' stream route rules, which contains TCP or UDP rules.
stream[].protocolstring (required)The protocol of rule. Support TCP or UDP
stream[].namestring (required)The Route rule name.
stream[].matchobject (required)The Route match conditions.
stream[].match.ingressPortinteger (required)the Ingress proxy server listening port, note since APISIX doesn't support dynamic listening, this port should be defined in apisix configuration.
stream[].backendobjectThe backend service. Deprecated: use http[].backends instead.
stream[].backend.serviceNamestringThe backend service name, note the service and ApisixRoute should be created in the same namespace. Cross namespace referencing is not allowed.
stream[].backend.servicePortinteger or stringThe backend service port, can be the port number or the name defined in the service object.
stream[].backend.resolveGranularitystringSee Service Resolve Granularity for the details.
stream[].backend.subsetstringSubset specifies a subset for the target Service. The subset should be pre-definedin ApisixUpstream about this service.

Expression Operators#

OperatorMeaning
EqualThe result of subject should be equal to the value
NotEqualThe result of subject should not be equal to value
GreaterThanThe result of subject should be a number and it must larger then value.
LessThanThe result of subject should be a number and it must less than value.
InThe result of subject should be inside the set.
NotInThe result of subject should not be inside the set.
RegexMatchThe result of subject should be matched by the value (a PCRE regex pattern).
RegexNotMatchThe result of subject should not be matched by the value (a PCRE regex pattern).
RegexMatchCaseInsensitiveSimilar with RegexMatch but the match process is case insensitive
RegexNotMatchCaseInsensitiveSimilar with RegexNotMatchCaseInsensitive but the match process is case insensitive.

Service Resolve Granularity#

The service resolve granularity determines whether the Serivce ClusterIP or its endpoints should be filled in the target upstream of APISIX.

GranularityMeaning
endpointFilled upstream nodes by Pods' IP.
serviceFilled upstream nodes by Service ClusterIP, in such a case, loadbalacing are implemented by kube-proxy.