跳到主要内容
版本:3.9.x

自定义资源定义 API 参考

本文档提供 API7 Ingress Controller 自定义资源定义 (CRD) 的 API 资源描述。

包 (Packages)

apisix.apache.org/v1alpha1

v1alpha1 包包含 apisix.apache.org v1alpha1 API 组的 API Schema 定义。

BackendTrafficPolicy

BackendTrafficPolicy 定义应用于后端服务的流量处理策略配置。

字段描述
apiVersion stringapisix.apache.org/v1alpha1
kind stringBackendTrafficPolicy
metadata ObjectMeta有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。
spec BackendTrafficPolicySpecBackendTrafficPolicySpec 定义应用于后端服务的流量处理策略,例如负载均衡策略、连接设置和故障转移行为。

Consumer

Consumer 定义消费者的配置。

字段描述
apiVersion stringapisix.apache.org/v1alpha1
kind stringConsumer
metadata ObjectMeta有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。
spec ConsumerSpecConsumerSpec 定义消费者的配置,包括消费者名称、身份验证凭据和插件设置。

GatewayProxy

GatewayProxy 定义用于将流量路由到服务的网关代理实例的配置。

字段描述
apiVersion stringapisix.apache.org/v1alpha1
kind stringGatewayProxy
metadata ObjectMeta有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。
spec GatewayProxySpecGatewayProxySpec 定义网关代理实例的配置,包括网络设置、全局插件和插件元数据。

HTTPRoutePolicy

HTTPRoutePolicy 定义流量策略的配置。

字段描述
apiVersion stringapisix.apache.org/v1alpha1
kind stringHTTPRoutePolicy
metadata ObjectMeta有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。
spec HTTPRoutePolicySpecHTTPRoutePolicySpec 定义 HTTPRoutePolicy 的配置,包括路由优先级和请求匹配条件。

PluginConfig

PluginConfig 定义插件配置。

字段描述
apiVersion stringapisix.apache.org/v1alpha1
kind stringPluginConfig
metadata ObjectMeta有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。
spec PluginConfigSpecPluginConfigSpec 定义 PluginConfig 的所需状态,其中指定了插件及其配置。

类型 (Types)

本节描述 CRD 使用的类型。

AdminKeyAuth

AdminKeyAuth 定义管理密钥身份验证配置。

字段描述
value stringValue 显式设置管理密钥值(不推荐用于生产环境)。
valueFrom AdminKeyValueFromValueFrom 指定管理密钥的来源。

出现在:

AdminKeyValueFrom

AdminKeyValueFrom 定义管理密钥的来源。

字段描述
secretKeyRef SecretKeySelectorSecretKeyRef 引用 Secret 中的一个键。

出现在:

AuthType

基本类型: string

AuthType 定义身份验证的类型。

出现在:

BackendPolicyTargetReferenceWithSectionName

基本类型: LocalPolicyTargetReferenceWithSectionName

字段描述
group GroupGroup 是目标资源的组。
kind KindKind 是目标资源的种类。
name ObjectNameName 是目标资源的名称。
sectionName SectionNameSectionName 是目标资源中某个部分(section)的名称。当未指定时,此 targetRef 将以整个资源为目标。在以下资源中,SectionName 解释如下:

• Gateway:监听器名称
• HTTPRoute:HTTPRouteRule 名称
• Service:端口名称

如果指定了 SectionName,但在目标对象上不存在,则该 Policy 必须附加失败,并且策略实现应在 Policy 状态中记录 ResolvedRefs 或类似 Condition。

出现在:

BackendTrafficPolicySpec

字段描述
targetRefs BackendPolicyTargetReferenceWithSectionName arrayTargetRef 标识应用策略的 API 对象。目前,Backends(即 Service、ServiceImport 或任何特定于实现的 backendRef)是唯一有效的 API 目标引用。
loadbalancer LoadBalancerLoadBalancer 表示 Kubernetes Service 的负载均衡器配置。默认策略是轮询(round robin)。
scheme stringScheme 是用于与上游通信的协议。默认为 http。可以是 httphttpsgrpcgrpcs
retries integerRetries 指定网关在发生超时或 502 错误等错误时应重试发送请求的次数。
timeout TimeoutTimeout 设置连接上游的读取、发送和连接超时。
passHost stringPassHost 配置当请求被转发到上游时应如何决定主机头(Host header)。默认为 pass。可以是 passnoderewrite
pass:保留原始的 Host 头
node:使用上游节点的主机
rewrite:通过 upstreamHost 设置为自定义主机
upstreamHost HostnameUpstreamHost 指定上游请求的主机。仅在 passHost 设置为 rewrite 时使用。

出现在:

ConsumerSpec

字段描述
gatewayRef GatewayRefGatewayRef 指定网关详情。
credentials Credential arrayCredentials 指定消费者的凭据详情。
plugins Plugin arrayPlugins 定义与消费者关联的插件。

出现在:

ControlPlaneAuth

ControlPlaneAuth 定义控制面的身份验证配置。

字段描述
type AuthTypeType 指定身份验证的类型。只能是 AdminKey
adminKey AdminKeyAuthAdminKey 指定管理密钥身份验证配置。

出现在:

ControlPlaneProvider

ControlPlaneProvider 定义控制面提供商的配置。

字段描述
mode stringMode 指定控制面提供商的模式。可以是 apisixapisix-standalone
endpoints string arrayEndpoints 指定控制面端点列表。
service ProviderService
tlsVerify booleanTlsVerify 指定是否验证控制面的 TLS 证书。
auth ControlPlaneAuthAuth 指定身份验证配置。

出现在:

Credential

字段描述
type stringType 指定要配置凭据的身份验证类型。可以是 jwt-authbasic-authkey-authhmac-auth
config JSONConfig 指定身份验证的凭据详情。
secretRef SecretReferenceSecretRef 引用包含凭据的 Secret。
name stringName 是凭据的名称。

出现在:

GatewayProxyPlugin

GatewayProxyPlugin 包含插件配置。

字段描述
name stringName 是插件的名称。
enabled booleanEnabled 定义插件是否启用。
config JSONConfig 定义插件的配置详情。

出现在:

GatewayProxyProvider

GatewayProxyProvider 定义 GatewayProxy 的提供商配置。

字段描述
type ProviderTypeType 指定提供商的类型。只能是 ControlPlane
controlPlane ControlPlaneProviderControlPlane 指定控制面提供商的配置。

出现在:

GatewayProxySpec

GatewayProxySpec 定义 GatewayProxy 的期望状态。

字段描述
publishService stringPublishService 指定 LoadBalancer 类型的 Service,控制器使用其外部地址来更新 Ingress 资源的状态。
statusAddress string arrayStatusAddress 指定控制器用于填充 GatewayProxy 或 Ingress 资源的状态字段以供开发人员访问的外部 IP 地址。
provider GatewayProxyProvider提供商配置提供商详细信息。
plugins GatewayProxyPlugin array插件配置全局插件。
pluginMetadata object (keys:string, values:JSON)PluginMetadata 配置所有同名插件实例共享的通用配置。

出现在:

GatewayRef

字段描述
name string名称是网关的名称。
kind stringKind 是 Kubernetes 对象的类型。默认为Gateway
group stringGroup 是资源所属的 API 组。默认为gateway.networking.k8s.io
namespace string命名空间是资源的命名空间。

出现在:

HTTPRoutePolicySpec

HTTPRoutePolicySpec 定义 HTTPRoutePolicy 的所需状态。

字段描述
targetRefs LocalPolicyTargetReferenceWithSectionName arrayTargetRef 标识要应用 HTTPRoutePolicy的API 对象(即 HTTPRoute、Ingress)。
priority integer优先级设置路由的优先级。当多个路由具有相同的 URI 路径时,值越大,路由匹配的优先级越高。
vars JSON arrayVars 设置请求匹配条件。

出现在:

Hostname

基本类型: string

出现在:

LoadBalancer

LoadBalancer描述了负载均衡的参数。

字段描述
type string类型指定将流量路由到后端的负载平衡算法。默认为roundrobin。可以是 roundrobinchashewmaleast_conn
hashOn stringHashOn 指定用于散列的字段类型,当类型为chash时需要。默认为vars。可以是 varsheadercookieconsumervars_combinations
key stringKey 与 HashOn 配合使用,一般类型为chash时需要。当 HashOn 为headercookie时,指定 header 或 cookie 的名称。当 HashOn 为consumer时,不需要 key,因为会自动使用使用者名称。当HashOn为varsvars_combinations时,key指built-in variables中的一个或组合。

出现在:

Plugin

字段描述
name string名称是插件的名称。
config JSONConfig 是插件配置详细信息。

出现在:

PluginConfigSpec

PluginConfigSpec 定义了 PluginConfig 的所需状态。

字段描述
plugins Plugin array插件是一系列插件及其要应用的配置。

出现在:

ProviderService

字段描述
name string名称是提供者的名称。
port integer端口是提供商的端口。

出现在:

ProviderType

基本类型: string

ProviderType 定义提供者的类型。

出现在:

SecretKeySelector

SecretKeySelector 定义对 Secret 中特定密钥的引用。

字段描述
name string名称是秘密的名称。
key stringKey 是秘密中用于检索秘密的密钥。

出现在:

SecretReference

字段描述
name string名称是秘密的名称。
namespace string命名空间是秘密的命名空间。

出现在:

Status

字段描述
conditions Condition array

出现在:

Timeout

字段描述
connect Duration连接超时。默认为60s
send Duration发送超时。默认为60s
read Duration读取超时。默认为60s

出现在:

apisix.apache.org/v2

包 v2 包含 apisix.apache.org v2 API 组的 API 架构定义。

ApisixConsumer

ApisixConsumer 定义使用者的配置及其身份验证详细信息。

FieldDescription
apiVersion stringapisix.apache.org/v2
kind stringApisixConsumer
metadata ObjectMetaPlease refer to the Kubernetes API documentation for details on the metadata field.
spec ApisixConsumerSpecApisixConsumerSpec defines the consumer authentication configuration.

ApisixGlobalRule

ApisixGlobalRule defines configuration for global plugins.

字段描述
apiVersion stringapisix.apache.org/v2
kind stringApisixGlobalRule
metadata ObjectMeta有关metadata字段的详细信息,请参阅 Kubernetes API 文档。
spec ApisixGlobalRuleSpecApisixGlobalRuleSpec 定义全局插件配置。

ApisixPluginConfig

ApisixPluginConfig 定义了一组可重用的插件配置,可以通过路由引用。

FieldDescription
apiVersion stringapisix.apache.org/v2
kind stringApisixPluginConfig
metadata ObjectMetaPlease refer to the Kubernetes API documentation for details on the metadata field.
spec ApisixPluginConfigSpecApisixPluginConfigSpec defines the plugin config configuration.

ApisixRoute

ApisixRoute defines configuration for HTTP and stream routes.

字段描述
apiVersion stringapisix.apache.org/v2
kind stringApisixRoute
metadata ObjectMeta有关metadata字段的详细信息,请参阅 Kubernetes API 文档。
spec ApisixRouteSpecApisixRouteSpec 定义 HTTP 和流路由配置。

ApisixTls

ApisixTls 定义 TLS 和双向 TLS (mTLS) 的配置。

FieldDescription
apiVersion stringapisix.apache.org/v2
kind stringApisixTls
metadata ObjectMetaPlease refer to the Kubernetes API documentation for details on the metadata field.
spec ApisixTlsSpecApisixTlsSpec defines the TLS configuration.

ApisixUpstream

ApisixUpstream defines configuration for upstream services.

字段描述
apiVersion stringapisix.apache.org/v2
kind stringApisixUpstream
metadata ObjectMeta有关metadata字段的详细信息,请参阅 Kubernetes API 文档。
spec ApisixUpstreamSpecApisixUpstreamSpec 定义上游配置。

Types

本节描述 CRD 使用的类型。

ActiveHealthCheck

ActiveHealthCheck 定义主动上游健康检查配置。

字段描述
type stringType 为健康检查类型。可以是 httphttpstcp
timeout DurationTimeout 设置健康检查超时时间(以秒为单位)。
concurrency integer并发设置同时检查的目标数量。
host stringHost 设置上游主机。
port integerPort 设置上行端口。
httpPath stringHTTPPath 设置 HTTP 探测请求路径。
strictTLS booleanStrictTLS 设置是否强制执行 TLS。
requestHeaders string arrayRequestHeaders 设置请求标头。
healthy ActiveHealthCheckHealthyHealthy 配置将上游节点定义为健康的规则。
unhealthy ActiveHealthCheckUnhealthy不健康配置将上游节点定义为不健康的规则。

出现在:

ActiveHealthCheckHealthy

UpstreamActiveHealthCheckHealthy 定义了用于主动判断上游节点是否健康的条件。

字段描述
httpCodes integer arrayHTTPCodes 定义了一系列被认为是健康的 HTTP 状态代码。
successes integer成功定义了成功探测的数量,以定义健康目标。
interval Duration间隔定义检查目标的时间间隔,以秒为单位。

出现在:

ActiveHealthCheckUnhealthy

UpstreamActiveHealthCheckHealthy定义了用于主动判断上游节点是否不健康的条件。

字段描述
httpCodes integer arrayHTTPCodes 定义了被视为不健康的 HTTP 状态代码列表。
httpFailures integerHTTPFailures 定义 HTTP 失败的数量来定义不健康的目标。
tcpFailures integerTCPFailures 定义 TCP 失败的数量来定义不健康的目标。
timeout integer超时设置超时次数来定义不健康的目标。
interval Duration间隔定义检查目标的时间间隔,以秒为单位。

出现在:

ApisixConsumerAuthParameter

字段描述
basicAuth ApisixConsumerBasicAuthBasicAuth 配置基本身份验证详细信息。
keyAuth ApisixConsumerKeyAuthKeyAuth 配置密钥身份验证详细信息。
wolfRBAC ApisixConsumerWolfRBACWolfRBAC 配置 Wolf RBAC 身份验证详细信息。
jwtAuth ApisixConsumerJwtAuthJwtAuth 配置 JWT 身份验证详细信息。
hmacAuth ApisixConsumerHMACAuthHMACAuth 配置 HMAC 身份验证详细信息。
ldapAuth ApisixConsumerLDAPAuthLDAPAuth 配置 LDAP 身份验证详细信息。

出现在:

ApisixConsumerBasicAuth

ApisixConsumerBasicAuth 定义基本身份验证的配置。

字段描述
secretRef LocalObjectReferenceSecretRef 引用包含基本身份验证凭据的 Kubernetes Secret。
value ApisixConsumerBasicAuthValue值指定基本身份验证凭据。

出现在:

ApisixConsumerBasicAuthValue

ApisixConsumerBasicAuthValue 定义基本身份验证的用户名和密码配置。

字段描述
username string用户名是基本认证用户名。
password string密码为基本认证密码。

出现在:

ApisixConsumerHMACAuth

ApisixConsumerHMACAuth 定义 HMAC 身份验证的配置。

字段描述
secretRef LocalObjectReferenceSecretRef 引用包含 HMAC 凭证的 Kubernetes Secret。
value ApisixConsumerHMACAuthValue值指定 HMAC 身份验证凭据。

出现在:

ApisixConsumerHMACAuthValue

ApisixConsumerHMACAuthValue 定义 HMAC 身份验证的配置。

字段描述
key_id stringKeyID 是用于查找 HMAC 密钥的标识符。
secret_key stringSecretKey 是用于签署请求的 HMAC 密钥。
access_key stringAccessKey 是用于查找 HMAC 秘密的标识符。从消费者配置中弃用
algorithm string算法指定哈希算法(例如“hmac-sha256”)。从消费者配置中弃用
clock_skew integerClockSkew 是客户端和服务器时钟之间允许的时间差(以秒为单位)。从消费者配置中弃用
signed_headers string arraySignedHeaders 列出了签名中必须包含的标头。从消费者配置中弃用
keep_headers booleanKeepHeaders 确定验证后是否保留 HMAC 签名标头。从消费者配置中弃用
encode_uri_params booleanEncodeURIParams表示计算签名时是否对URI参数进行编码。从消费者配置中弃用
validate_request_body booleanValidateRequestBody 启用请求正文的 HMAC 验证。从消费者配置中弃用
max_req_body integerMaxReqBody 设置可以验证的请求正文的最大大小(以字节为单位)。从消费者配置中弃用

出现在:

ApisixConsumerJwtAuth

ApisixConsumerJwtAuth 定义 JWT 身份验证的配置。

字段描述
secretRef LocalObjectReferenceSecretRef 引用包含 JWT 身份验证凭据的 Kubernetes Secret。
value ApisixConsumerJwtAuthValue值指定 JWT 身份验证凭据。

出现在:

ApisixConsumerJwtAuthValue

ApisixConsumerJwtAuthValue 定义 JWT 身份验证的配置。

字段描述
key stringKey 是 JWT 凭证的唯一标识符。
secret stringSecret 是用于签署 JWT 的共享密钥(对于对称算法)。
public_key stringPublicKey是用于验证JWT签名的公钥(对于非对称算法)。
private_key stringPrivateKey 是用于签署 JWT 的私钥(对于非对称算法)。
algorithm string算法指定签名算法。可以是HS256HS384HS512RS256RS384RS512ES256ES384ES512PS256PS384PS512EdDSA。目前APISIX仅支持HS256HS512RS256ES256。 API7 Enterprise 支持所有算法。
exp integerExp 是令牌有效期(以秒为单位)。
base64_secret booleanBase64Secret 指示密钥是否采用 Base64 编码。
lifetime_grace_period integerLifetimeGracePeriod 是令牌过期时允许的时钟偏差(以秒为单位)。

出现在:

ApisixConsumerKeyAuth

ApisixConsumerKeyAuth 定义密钥身份验证的配置。

字段描述
secretRef LocalObjectReferenceSecretRef 引用包含密钥身份验证凭据的 Kubernetes Secret。
value ApisixConsumerKeyAuthValue值指定密钥身份验证凭据。

出现在:

ApisixConsumerKeyAuthValue

ApisixConsumerKeyAuthValue 定义密钥身份验证的配置。

字段描述
key stringKey是用于密钥认证的凭证。

出现在:

ApisixConsumerLDAPAuth

ApisixConsumerLDAPAuth 定义 LDAP 身份验证的配置。

字段描述
secretRef LocalObjectReferenceSecretRef 引用包含 LDAP 凭证的 Kubernetes Secret。
value ApisixConsumerLDAPAuthValue值指定 LDAP 身份验证凭据。

出现在:

ApisixConsumerLDAPAuthValue

ApisixConsumerLDAPAuthValue 定义 LDAP 身份验证的配置。

字段描述
user_dn stringUserDN 是 LDAP 用户的专有名称 (DN)。

出现在:

ApisixConsumerSpec

ApisixConsumerSpec 定义 ApisixConsumer 的所需状态。

字段描述
ingressClassName stringIngressClassName 是 IngressClass 集群资源的名称。控制器使用此字段来决定是否应管理资源。
authParameter ApisixConsumerAuthParameterAuthParameter 定义此使用者的身份验证凭据和配置。

出现在:

ApisixConsumerWolfRBAC

ApisixConsumerWolfRBAC 定义 Wolf RBAC 身份验证的配置。

字段描述
secretRef LocalObjectReferenceSecretRef 引用包含 Wolf RBAC 令牌的 Kubernetes Secret。
value ApisixConsumerWolfRBACValue值指定 Wolf RBAC 令牌。

出现在:

ApisixConsumerWolfRBACValue

ApisixConsumerWolfRBACValue 定义 Wolf RBAC 身份验证的配置。

字段描述
server string服务器是 Wolf RBAC 服务器的 URL。
appid stringAppid 是与 Wolf RBAC 服务器通信时使用的应用程序标识符。
header_prefix stringHeaderPrefix 是添加到请求标头以执行 RBAC 的前缀。

出现在:

ApisixGlobalRuleSpec

ApisixGlobalRuleSpec 定义全局插件的配置。

字段描述
ingressClassName stringIngressClassName 是 IngressClass 集群资源的名称。控制器使用此字段来决定是否应管理资源。
plugins ApisixRoutePlugin array插件包含全局插件列表。

出现在:

ApisixMutualTlsClientConfig

ApisixMutualTlsClientConfig 描述相互 TLS CA 和验证设置。

字段描述
caSecret ApisixSecretCASecret 引用包含 CA 证书的机密以进行客户端证书验证。
depth integer深度指定客户端证书链的最大验证深度。
skip_mtls_uri_regex string arraySkipMTLSUriRegex 包含用于跳过相互 TLS 验证的 URI 的正则表达式模式。

出现在:

ApisixPluginConfigSpec

ApisixPluginConfigSpec 定义 ApisixPluginConfigSpec 的所需状态。

字段描述
ingressClassName stringIngressClassName 是 IngressClass 集群资源的名称。控制器使用此字段来决定是否应管理资源。
plugins ApisixRoutePlugin array插件包含插件列表。

出现在:

ApisixRouteAuthentication

ApisixRouteAuthentication 表示 ApisixRoute 中与身份验证相关的配置。

字段描述
enable boolean启用可打开或关闭身份验证。
type string类型指定身份验证类型。
keyAuth ApisixRouteAuthenticationKeyAuthKeyAuth 定义密钥认证的配置。
jwtAuth ApisixRouteAuthenticationJwtAuthJwtAuth 定义 JWT 身份验证的配置。
ldapAuth ApisixRouteAuthenticationLDAPAuthLDAPAuth 定义 LDAP 身份验证的配置。

出现在:

ApisixRouteAuthenticationJwtAuth

ApisixRouteAuthenticationJwtAuth 在 ApisixRouteAuthentication 中定义 JWT 身份验证配置。

字段描述
header stringHeader 指定用于查找 JWT 令牌的 HTTP 标头名称。
query stringQuery 指定用于查找 JWT 令牌的 URL 查询参数名称。
cookie stringCookie 指定用于查找 JWT 令牌的 cookie 名称。

出现在:

ApisixRouteAuthenticationKeyAuth

ApisixRouteAuthenticationKeyAuth 在 ApisixRouteAuthentication 中定义密钥身份验证配置。

字段描述
header stringHeader 指定用于查找密钥身份验证令牌的 HTTP 标头名称。

出现在:

ApisixRouteAuthenticationLDAPAuth

ApisixRouteAuthenticationLDAPAuth 在 ApisixRouteAuthentication 中定义 LDAP 身份验证配置。

字段描述
base_dn stringBaseDN 是 LDAP 搜索的基本专有名称 (DN)。
ldap_uri stringLDAPURI 是 LDAP 服务器的 URI。
use_tls booleanUseTLS 指示是否对 LDAP 连接使用 TLS。
uid stringUID是LDAP中的用户标识符属性。

出现在:

ApisixRouteHTTP

ApisixRouteHTTP 表示单个 HTTP 路由配置。

字段描述
name string名称是唯一的规则名称,不能为空。
priority integer优先级定义了多个路由共享相同 URI 路径时的路由优先级。值越大表示路由匹配的优先级越高。
timeout UpstreamTimeout超时指定上游超时设置。
match ApisixRouteHTTPMatchMatch定义了HTTP请求的匹配标准。
backends ApisixRouteHTTPBackend array后端列出了代理请求的潜在后端服务。如果指定多个后端,则使用traffic-split插件根据后端权重分配流量。
upstreams ApisixRouteUpstreamReference array上游引用 ApisixUpstream CRD。
websocket booleanWebsocket 启用或禁用对此路由的 Websocket 支持。
plugin_config_name stringPluginConfigName 指定要应用的插件配置的名称。
plugin_config_namespace stringPluginConfigNamespace 指定插件配置的命名空间。如果未设置,则默认为 ApisixRoute 的命名空间。
plugins ApisixRoutePlugin array插件列出了应用于此路由的其他插件。
authentication ApisixRouteAuthentication身份验证保存此路由的身份验证相关配置。

出现在:

ApisixRouteHTTPBackend

ApisixRouteHTTPBackend 表示 HTTP 后端(Kubernetes 服务)。

字段描述
serviceName stringServiceName 是 Kubernetes 服务的名称。不支持跨命名空间引用 - 确保 ApisixRoute 和服务位于同一命名空间中。
servicePort IntOrStringServicePort 是 Kubernetes Service 的端口。这可以是端口名称或端口号。
resolveGranularity stringResolveGranularity决定了后端服务如何解析。有效值为endpointsservice。当设置为endpoints时,将使用单独的 pod IP;否则,使用服务的ClusterIP 或ExternalIP。默认为endpoints
weight integer权重指定该后端的相对流量权重。
subset string子集指定目标服务的命名子集。该子集必须在相应的 ApisixUpstream 资源中预定义。

出现在:

ApisixRouteHTTPMatch

ApisixRouteHTTPMatch 定义用于匹配传入 HTTP 请求的条件。

字段描述
paths string arrayPaths 是要匹配的 URI 路径模式的列表。必须至少指定一个路径。支持精确匹配和前缀匹配。对于前缀匹配,请将*附加到路径,例如/foo*
methods string array方法指定要匹配的 HTTP 方法。
hosts string arrayHosts 指定要匹配的主机标头值。支持精确域和通配符域。仅允许使用一级通配符(例如,*.example.com 有效,但*.*.example.com无效)。
remoteAddrs string arrayRemoteAddrs 是要匹配的源 IP 地址或 CIDR 范围的列表。支持 IPv4和IPv6 格式。
exprs ApisixRouteHTTPMatchExprsNginxVars 基于 Nginx 变量定义匹配条件。
filter_func stringFilterFunc 是用于高级请求过滤的用户定义函数。该函数可以通过vars参数使用Nginx变量。 APISIX 支持此字段,但 API7 Enterprise 不支持。

出现在:

ApisixRouteHTTPMatchExpr

ApisixRouteHTTPMatchExpr 表示用于基于 Nginx 变量匹配请求的二进制表达式。

字段描述
subject ApisixRouteHTTPMatchExprSubject主题定义表达式的左侧。它可以是任何built-in variable或字符串文字。
op stringOp 指定表达式中使用的运算符。可以是 EqualNotEqualGreaterThanGreaterThanEqualLessThanLessThanEqualRegexMatchRegexNotMatchRegexMatchCaseInsensitiveRegexNotMatchCaseInsensitiveInNotIn
set string arraySet 提供表达式可接受的值的列表。当 Op 为InNotIn时应使用此选项。
value string值定义与主题进行比较的单个值。当 Op 不是InNotIn时应使用此选项。 Set和Value 是互斥的——一次只能设置一个。

出现在:

ApisixRouteHTTPMatchExprSubject

ApisixRouteHTTPMatchExprSubject 描述路由匹配表达式的主题。

字段描述
scope string范围指定主题范围,可以是HeaderQueryPath。当 Scope 为Path时,Name 将被忽略。
name string名称是标头或查询参数的名称。

出现在:

ApisixRouteHTTPMatchExprs

基本类型: ApisixRouteHTTPMatchExpr

字段描述
subject ApisixRouteHTTPMatchExprSubject主题定义表达式的左侧。它可以是任何built-in variable或字符串文字。
op stringOp 指定表达式中使用的运算符。可以是 EqualNotEqualGreaterThanGreaterThanEqualLessThanLessThanEqualRegexMatchRegexNotMatchRegexMatchCaseInsensitiveRegexNotMatchCaseInsensitiveInNotIn
set string arraySet 提供表达式可接受的值的列表。当 Op 为InNotIn时应使用此选项。
value string值定义与主题进行比较的单个值。当 Op 不是InNotIn时应使用此选项。 Set和Value 是互斥的——一次只能设置一个。

出现在:

ApisixRoutePlugin

ApisixRoutePlugin 代表 APISIX 插件。

字段描述
name string插件名称。
enable boolean是否使用该插件,默认为true。
config JSON插件配置。
secretRef string插件配置secretRef。

出现在:

ApisixRouteSpec

ApisixRouteSpec 是 ApisixRoute 的规范定义。 它定义了 HTTP 和流流量的路由规则。

字段描述
ingressClassName stringIngressClassName 是该路由所属的 IngressClass 的名称。它允许多个控制器监视和协调不同的路线。
http ApisixRouteHTTP arrayHTTP 定义了 HTTP 路由规则列表。每个规则指定匹配 HTTP 请求的条件以及如何转发它们。
stream ApisixRouteStream arrayStream定义了流路由规则列表。每个规则指定匹配 TCP/UDP 流量的条件以及如何转发它们。

出现在:

ApisixRouteStream

ApisixRouteStream 定义第 4 层 (TCP/UDP) 路由的配置。

字段描述
name string名称是路线的唯一标识符。该字段不能为空。
protocol stringProtocol 指定要匹配的 L4 协议。可以是TCPUDP
match ApisixRouteStreamMatch匹配定义用于匹配传入 TCP 或 UDP 连接的条件。
backend ApisixRouteStreamBackendBackend 指定流量应转发到的目标服务。
plugins ApisixRoutePlugin array插件定义了应用于此路由的插件列表。

出现在:

ApisixRouteStreamBackend

ApisixRouteStreamBackend 表示 TCP 或 UDP 流路由的后端服务。

字段描述
serviceName stringServiceName 是 Kubernetes 服务的名称。不支持跨命名空间引用 - 确保 ApisixRoute 和服务位于同一命名空间中。
servicePort IntOrStringServicePort 是 Kubernetes Service 的端口。这可以是端口名称或端口号。
resolveGranularity stringResolveGranularity决定了后端服务如何解析。有效值为endpointservice。当设置为endpoint时,将使用单独的 pod IP;否则,使用服务的ClusterIP 或ExternalIP。默认为endpoint
subset string子集指定目标服务的命名子集。该子集必须在相应的 ApisixUpstream 资源中预定义。

出现在:

ApisixRouteStreamMatch

ApisixRouteStreamMatch 表示流路由的匹配条件。

字段描述
ingressPort integerIngressPort 是 APISIX Ingress 代理服务器侦听的端口。这必须是静态配置的端口,因为 APISIX 不支持动态端口绑定。
host stringHost 是用于匹配传入 TCP/UDP 流量的目标主机地址。

出现在:

ApisixRouteUpstreamReference

ApisixRouteUpstreamReference 引用要用作后端的 ApisixUpstream CRD。 它可用于流量分割场景或选择特定的上游配置。

字段描述
name string名称是 ApisixUpstream 资源的名称。
weight integer权重是分配给该上游的权重。

出现在:

ApisixSecret

ApisixSecret 描述了对 Kubernetes Secret 的引用,包括其名称和命名空间。 这用于查找秘密,例如插件的证书或凭据或 TLS 配置。

字段描述
name string名称是 Kubernetes Secret 的名称。
namespace stringNamespace是Kubernetes Secret所在的命名空间。

出现在:

ApisixTlsSpec

ApisixTlsSpec 定义 TLS 和相互 TLS 的配置。

字段描述
ingressClassName stringIngressClassName 指定此资源与哪个 IngressClass 关联。 APISIX 控制器仅在类与其自身匹配的情况下处理此资源。
hosts HostType array主机列出了此 TLS 配置适用的 SNI(服务器名称指示)主机名。必须至少包含一台主机。
secret ApisixSecretSecret 是指包含证书和私钥的 Kubernetes TLS 密钥。此机密必须存在于指定的命名空间中并包含有效的 TLS 数据。
client ApisixMutualTlsClientConfig客户端定义双向 TLS (mTLS) 设置,例如 CA 证书和验证深度。

出现在:

ApisixUpstreamConfig

ApisixUpstreamConfig 定义上游服务的配置。

字段描述
loadbalancer LoadBalancerLoadBalancer 指定 Kubernetes 服务的负载均衡器配置。
scheme string方案是用于与上游通信的协议。默认为http。可以是 httphttpsgrpcgrpcs
retries integer重试定义了发生故障时 APISIX 应进行的重试尝试次数。故障包括超时、网络错误或 5xx 状态代码。
timeout UpstreamTimeout超时指定上游请求的连接、发送和读取超时。
healthCheck HealthCheckHealthCheck 定义上游的主动和被动健康检查配置。
tlsSecret ApisixSecretTLSSecret 引用 Kubernetes Secret,其中包含连接到上游时用于双向 TLS 的客户端证书和密钥。
subsets ApisixUpstreamSubset array子集定义了服务端点的标记子集,通常用于服务版本控制或金丝雀部署。
passHost stringPassHost 配置当请求转发到上游时应如何确定主机标头。默认为pass。可以是passnoderewrite
pass:保留原始主机头
node:使用上游节点的主机
rewrite:通过upstreamHost 设置为自定义主机
upstreamHost string当 passHost 设置为rewrite时,UpstreamHost 设置自定义主机标头。
discovery DiscoveryDiscovery 为上游配置服务发现。

出现在:

ApisixUpstreamExternalNode

ApisixUpstreamExternalNode 定义外部上游节点的配置。 这允许引用集群外部的服务。

字段描述
name string名称是外部节点的主机名或 IP 地址。
type ApisixUpstreamExternalTypeType 表示外部节点的类型。可以是DomainService
weight integer权重定义了该节点的负载均衡权重。较高的值会增加发送到该节点的流量份额。
port integer端口指定外部节点接受流量的端口号。

出现在:

ApisixUpstreamExternalType

基本类型: string

ApisixUpstreamExternalType 是外部服务类型

出现在:

ApisixUpstreamSpec

ApisixUpstreamSpec 描述 ApisixUpstream 资源的所需配置。 它定义流量应如何路由到后端服务,包括上游节点 定义和自定义配置。

字段描述
ingressClassName stringIngressClassName 是 IngressClass 集群资源的名称。控制器实现使用此字段来确定是否应处理此 ApisixUpstream 资源。
externalNodes ApisixUpstreamExternalNode arrayExternalNodes 定义后端节点的静态列表。这些可以是集群外部的外部主机,也可以是由其 DNS 名称指定的集群内部服务。设置此字段后,上游将直接将流量路由到这些节点,无需 DNS 解析或服务发现。
loadbalancer LoadBalancerLoadBalancer 指定 Kubernetes 服务的负载均衡器配置。
scheme string方案是用于与上游通信的协议。默认为http。可以是 httphttpsgrpcgrpcs
retries integer重试定义了发生故障时 APISIX 应进行的重试尝试次数。故障包括超时、网络错误或 5xx 状态代码。
timeout UpstreamTimeout超时指定上游请求的连接、发送和读取超时。
healthCheck HealthCheckHealthCheck 定义上游的主动和被动健康检查配置。
tlsSecret ApisixSecretTLSSecret 引用 Kubernetes Secret,其中包含连接到上游时用于双向 TLS 的客户端证书和密钥。
subsets ApisixUpstreamSubset array子集定义了服务端点的标记子集,通常用于服务版本控制或金丝雀部署。
passHost stringPassHost 配置当请求转发到上游时应如何确定主机标头。默认为pass。可以是passnoderewrite
pass:保留原始主机头
node:使用上游节点的主机
rewrite:通过upstreamHost 设置为自定义主机
upstreamHost string当 passHost 设置为rewrite时,UpstreamHost 设置自定义主机标头。
discovery DiscoveryDiscovery 为上游配置服务发现。
portLevelSettings PortLevelSettings arrayPortLevelSettings 允许对特定端口进行细粒度的上游配置,当后端服务公开具有不同行为或协议的多个端口时非常有用。

出现在:

ApisixUpstreamSubset

ApisixUpstreamSubset 定义一个服务的单个端点组。

字段描述
name string名称是子集的名称。
labels object (keys:string, values:string)Labels 是该子集的标签集。

出现在:

Discovery

Discovery定义了动态解析上游节点的服务发现配置。 当 APISIX 与 Nacos、Consul 或 Eureka 等服务注册表集成时使用。

字段描述
serviceName stringServiceName 是要发现的服务的名称。
type string类型是服务发现提供者的名称。
args object (keys:string, values:string)Args 包含发现提供程序所需的其他配置参数。它们作为键值对传递。

出现在:

HealthCheck

HealthCheck定义了上游节点的健康检查配置。 它包括主动检查(主动探测节点)和可选的被动检查(基于流量的监控)。

字段描述
active ActiveHealthCheck主动健康检查主动向上游节点发送请求以确定其可用性。
passive PassiveHealthCheck被动运行状况检查根据观察到的流量(例如超时或错误)评估上游运行状况。

出现在:

HostType

基本类型: string

出现在:

LoadBalancer

LoadBalancer定义了在上游节点之间分配流量的负载均衡策略。

字段描述
type string类型指定将流量路由到后端的负载平衡算法。默认为roundrobin。可以是 roundrobinchashewmaleast_conn
hashOn stringHashOn 指定用于散列的字段类型,当类型为chash时需要。默认为vars。可以是 varsheadercookieconsumervars_combinations
key stringKey 与 HashOn 配合使用,一般类型为chash时需要。当 HashOn 为headercookie时,指定 header 或 cookie 的名称。当 HashOn 为consumer时,不需要 key,因为会自动使用使用者名称。当HashOn为varsvars_combinations时,key指built-in variables中的一个或组合。

出现在:

PassiveHealthCheck

PassiveHealthCheck 定义了用于确定是否 根据被动观察,上游节点是否健康。 被动健康检查依赖于真实的流量响应而不是主动探测。

字段描述
type stringType 指定被动健康检查的类型。可以是 httphttpstcp
healthy PassiveHealthCheckHealthy健康定义了上游节点被视为健康的条件。
unhealthy PassiveHealthCheckUnhealthy不健康定义了上游节点被视为不健康的条件。

出现在:

PassiveHealthCheckHealthy

PassiveHealthCheckHealthy 定义用于被动确定上游节点是否健康的条件。

字段描述
httpCodes integer arrayHTTPCodes 定义了一系列被认为是健康的 HTTP 状态代码。
successes integer成功定义了成功探测的数量,以定义健康目标。

出现在:

PassiveHealthCheckUnhealthy

UpstreamPassiveHealthCheckUnhealthy 定义用于被动确定上游节点是否不健康的条件。

字段描述
httpCodes integer arrayHTTPCodes 定义了被视为不健康的 HTTP 状态代码列表。
httpFailures integerHTTPFailures 定义 HTTP 失败的数量来定义不健康的目标。
tcpFailures integerTCPFailures 定义 TCP 失败的数量来定义不健康的目标。
timeout integer超时设置超时次数来定义不健康的目标。

出现在:

PortLevelSettings

PortLevelSettings 为每个单独的端口配置 ApisixUpstreamConfig。它继承了 从外部级别(整个 Kubernetes 服务)进行配置并覆盖一些 如果它们是在端口级别设置的。

字段描述
loadbalancer LoadBalancerLoadBalancer 指定 Kubernetes 服务的负载均衡器配置。
scheme string方案是用于与上游通信的协议。默认为http。可以是 httphttpsgrpcgrpcs
retries integer重试定义了发生故障时 APISIX 应进行的重试尝试次数。故障包括超时、网络错误或 5xx 状态代码。
timeout UpstreamTimeout超时指定上游请求的连接、发送和读取超时。
healthCheck HealthCheckHealthCheck 定义上游的主动和被动健康检查配置。
tlsSecret ApisixSecretTLSSecret 引用 Kubernetes Secret,其中包含连接到上游时用于双向 TLS 的客户端证书和密钥。
subsets ApisixUpstreamSubset array子集定义了服务端点的标记子集,通常用于服务版本控制或金丝雀部署。
passHost stringPassHost 配置当请求转发到上游时应如何确定主机标头。默认为pass。可以是passnoderewrite
pass:保留原始主机头
node:使用上游节点的主机
rewrite:通过upstreamHost 设置为自定义主机
upstreamHost string当 passHost 设置为rewrite时,UpstreamHost 设置自定义主机标头。
discovery DiscoveryDiscovery 为上游配置服务发现。
port integer端口是 Kubernetes 服务端口。

出现在:

UpstreamTimeout

UpstreamTimeout 定义从上游连接、发送和读取的超时设置。

字段描述
connect Duration与上游建立连接的连接超时。
send Duration向上游发送数据的发送超时。
read Duration从上游读取数据的读取超时。

出现在: