Traefik & Kubernetes with Gateway API

The Kubernetes Gateway API, The Experimental Way.

Gateway API is the evolution of Kubernetes APIs that relate to Services, e.g. Ingress. The Gateway API project is part of Kubernetes, working under SIG-NETWORK.

The Kubernetes Gateway provider is a Traefik implementation of the service apis specifications from the Kubernetes SIGs.

This provider is proposed as an experimental feature and partially supports the service apis v0.1.0 specification.

Enabling The Experimental Kubernetes Gateway Provider

As this provider is in experimental stage, it needs to be activated in the experimental section of the static configuration.

File (TOML)

  1. [experimental]
  2. kubernetesGateway = true
  3. [providers.kubernetesGateway]
  4. #...

File (YAML)

  1. experimental:
  2. kubernetesGateway: true
  3. providers:
  4. kubernetesGateway: {}
  5. #...

CLI

  1. --experimental.kubernetesgateway=true --providers.kubernetesgateway=true #...

Configuration Requirements

All Steps for a Successful Deployment

  • Add/update the Kubernetes Gateway API definitions.
  • Add/update the RBAC for the Traefik custom resources.
  • Add all needed Kubernetes Gateway API resources.

Examples

Kubernetes Gateway Provider Basic Example

Gateway API

  1. ---
  2. kind: GatewayClass
  3. apiVersion: networking.x-k8s.io/v1alpha1
  4. metadata:
  5. name: my-gateway-class
  6. spec:
  7. controller: traefik.io/gateway-controller
  8. ---
  9. kind: Gateway
  10. apiVersion: networking.x-k8s.io/v1alpha1
  11. metadata:
  12. name: my-gateway
  13. spec:
  14. gatewayClassName: my-gateway-class
  15. listeners:
  16. - protocol: HTTPS
  17. port: 443
  18. tls:
  19. certificateRef:
  20. group: "core"
  21. kind: "Secret"
  22. name: "mysecret"
  23. routes:
  24. kind: HTTPRoute
  25. selector:
  26. matchLabels:
  27. app: foo
  28. ---
  29. kind: HTTPRoute
  30. apiVersion: networking.x-k8s.io/v1alpha1
  31. metadata:
  32. name: http-app-1
  33. namespace: default
  34. labels:
  35. app: foo
  36. spec:
  37. hostnames:
  38. - "whoami"
  39. rules:
  40. - matches:
  41. - path:
  42. type: Exact
  43. value: /foo
  44. forwardTo:
  45. - serviceName: whoami
  46. port: 80
  47. weight: 1

Whoami Service

  1. ---
  2. kind: Deployment
  3. apiVersion: apps/v1
  4. metadata:
  5. name: whoami
  6. spec:
  7. replicas: 2
  8. selector:
  9. matchLabels:
  10. app: whoami
  11. template:
  12. metadata:
  13. labels:
  14. app: whoami
  15. spec:
  16. containers:
  17. - name: whoami
  18. image: traefik/whoami
  19. ---
  20. apiVersion: v1
  21. kind: Service
  22. metadata:
  23. name: whoami
  24. spec:
  25. ports:
  26. - protocol: TCP
  27. port: 80
  28. selector:
  29. app: whoami

Traefik Service

  1. ---
  2. apiVersion: v1
  3. kind: ServiceAccount
  4. metadata:
  5. name: traefik-controller
  6. ---
  7. kind: Deployment
  8. apiVersion: apps/v1
  9. metadata:
  10. name: traefik
  11. spec:
  12. replicas: 1
  13. selector:
  14. matchLabels:
  15. app: traefik-lb
  16. template:
  17. metadata:
  18. labels:
  19. app: traefik-lb
  20. spec:
  21. serviceAccountName: traefik-controller
  22. containers:
  23. - name: traefik
  24. image: traefik/traefik:latest
  25. imagePullPolicy: IfNotPresent
  26. args:
  27. - --entrypoints.web.address=:80
  28. - --entrypoints.websecure.address=:443
  29. - --experimental.kubernetesgateway
  30. - --providers.kubernetesgateway
  31. ports:
  32. - name: web
  33. containerPort: 80
  34. - name: websecure
  35. containerPort: 443
  36. ---
  37. apiVersion: v1
  38. kind: Service
  39. metadata:
  40. name: traefik
  41. spec:
  42. selector:
  43. app: traefik-lb
  44. ports:
  45. - protocol: TCP
  46. port: 80
  47. targetPort: web
  48. name: web
  49. - protocol: TCP
  50. port: 443
  51. targetPort: websecure
  52. name: websecure
  53. type: LoadBalancer

Gateway API CRDs

  1. # All resources definition must be declared
  2. ---
  3. apiVersion: apiextensions.k8s.io/v1
  4. kind: CustomResourceDefinition
  5. metadata:
  6. annotations:
  7. controller-gen.kubebuilder.io/version: v0.4.0
  8. creationTimestamp: null
  9. name: gatewayclasses.networking.x-k8s.io
  10. spec:
  11. group: networking.x-k8s.io
  12. names:
  13. kind: GatewayClass
  14. listKind: GatewayClassList
  15. plural: gatewayclasses
  16. shortNames:
  17. - gc
  18. singular: gatewayclass
  19. scope: Cluster
  20. versions:
  21. - additionalPrinterColumns:
  22. - jsonPath: .spec.controller
  23. name: Controller
  24. type: string
  25. name: v1alpha1
  26. schema:
  27. openAPIV3Schema:
  28. description: "GatewayClass describes a class of Gateways available to the user for creating Gateway resources. \n GatewayClass is a Cluster level resource. \n Support: Core."
  29. properties:
  30. apiVersion:
  31. description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
  32. type: string
  33. kind:
  34. description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
  35. type: string
  36. metadata:
  37. type: object
  38. spec:
  39. description: Spec for this GatewayClass.
  40. properties:
  41. controller:
  42. description: "Controller is a domain/path string that indicates the controller that is managing Gateways of this class. \n Example: \"acme.io/gateway-controller\". \n This field is not mutable and cannot be empty. \n The format of this field is DOMAIN \"/\" PATH, where DOMAIN and PATH are valid Kubernetes names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). \n Support: Core"
  43. maxLength: 253
  44. type: string
  45. parametersRef:
  46. description: "ParametersRef is a controller-specific resource containing the configuration parameters corresponding to this class. This is optional if the controller does not require any additional configuration. \n Parameters resources are implementation specific custom resources. These resources must be cluster-scoped. \n If the referent cannot be found, the GatewayClass's \"InvalidParameters\" status condition will be true. \n Support: Custom"
  47. properties:
  48. group:
  49. description: Group is the group of the referent.
  50. maxLength: 253
  51. minLength: 1
  52. type: string
  53. kind:
  54. description: Kind is kind of the referent.
  55. maxLength: 253
  56. minLength: 1
  57. type: string
  58. name:
  59. description: Name is the name of the referent.
  60. maxLength: 253
  61. minLength: 1
  62. type: string
  63. required:
  64. - group
  65. - kind
  66. - name
  67. type: object
  68. required:
  69. - controller
  70. type: object
  71. status:
  72. default:
  73. conditions:
  74. - lastTransitionTime: "1970-01-01T00:00:00Z"
  75. message: Waiting for controller
  76. reason: Waiting
  77. status: Unknown
  78. type: InvalidParameters
  79. description: Status of the GatewayClass.
  80. properties:
  81. conditions:
  82. default:
  83. - lastTransitionTime: "1970-01-01T00:00:00Z"
  84. message: Waiting for controller
  85. reason: Waiting
  86. status: "False"
  87. type: Admitted
  88. description: Conditions is the current status from the controller for this GatewayClass.
  89. items:
  90. description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
  91. properties:
  92. lastTransitionTime:
  93. description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
  94. format: date-time
  95. type: string
  96. message:
  97. description: message is a human readable message indicating details about the transition. This may be an empty string.
  98. maxLength: 32768
  99. type: string
  100. observedGeneration:
  101. description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
  102. format: int64
  103. minimum: 0
  104. type: integer
  105. reason:
  106. description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
  107. maxLength: 1024
  108. minLength: 1
  109. pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
  110. type: string
  111. status:
  112. description: status of the condition, one of True, False, Unknown.
  113. enum:
  114. - "True"
  115. - "False"
  116. - Unknown
  117. type: string
  118. type:
  119. description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
  120. maxLength: 316
  121. pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
  122. type: string
  123. required:
  124. - lastTransitionTime
  125. - message
  126. - reason
  127. - status
  128. - type
  129. type: object
  130. maxItems: 8
  131. type: array
  132. x-kubernetes-list-map-keys:
  133. - type
  134. x-kubernetes-list-type: map
  135. type: object
  136. type: object
  137. served: true
  138. storage: true
  139. subresources:
  140. status: {}
  141. status:
  142. acceptedNames:
  143. kind: ""
  144. plural: ""
  145. conditions: []
  146. storedVersions: []
  147. ---
  148. apiVersion: apiextensions.k8s.io/v1
  149. kind: CustomResourceDefinition
  150. metadata:
  151. annotations:
  152. controller-gen.kubebuilder.io/version: v0.4.0
  153. creationTimestamp: null
  154. name: gateways.networking.x-k8s.io
  155. spec:
  156. group: networking.x-k8s.io
  157. names:
  158. kind: Gateway
  159. listKind: GatewayList
  160. plural: gateways
  161. shortNames:
  162. - gtw
  163. singular: gateway
  164. scope: Namespaced
  165. versions:
  166. - additionalPrinterColumns:
  167. - jsonPath: .spec.gatewayClassName
  168. name: Class
  169. type: string
  170. name: v1alpha1
  171. schema:
  172. openAPIV3Schema:
  173. description: "Gateway represents an instantiation of a service-traffic handling infrastructure by binding Listeners to a set of IP addresses. \n Implementations should add the `gateway-exists-finalizer.networking.x-k8s.io` finalizer on the associated GatewayClass whenever Gateway(s) is running. This ensures that a GatewayClass associated with a Gateway(s) is not deleted while in use."
  174. properties:
  175. apiVersion:
  176. description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
  177. type: string
  178. kind:
  179. description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
  180. type: string
  181. metadata:
  182. type: object
  183. spec:
  184. description: "GatewaySpec defines the desired state of Gateway. \n Not all possible combinations of options specified in the Spec are valid. Some invalid configurations can be caught synchronously via a webhook, but there are many cases that will require asynchronous signaling via the GatewayStatus block."
  185. properties:
  186. addresses:
  187. description: "Addresses requested for this gateway. This is optional and behavior can depend on the GatewayClass. If a value is set in the spec and the requested address is invalid, the GatewayClass MUST indicate this in the associated entry in GatewayStatus.Addresses. \n If no Addresses are specified, the GatewayClass may schedule the Gateway in an implementation-defined manner, assigning an appropriate set of Addresses. \n The GatewayClass MUST bind all Listeners to every GatewayAddress that it assigns to the Gateway. \n Support: Core"
  188. items:
  189. description: GatewayAddress describes an address that can be bound to a Gateway.
  190. properties:
  191. type:
  192. default: IPAddress
  193. description: "Type of the Address. This is either \"IPAddress\" or \"NamedAddress\". \n Support: Extended"
  194. enum:
  195. - IPAddress
  196. - NamedAddress
  197. type: string
  198. value:
  199. description: 'Value. Examples: "1.2.3.4", "128::1", "my-ip-address". Validity of the values will depend on `Type` and support by the controller.'
  200. maxLength: 253
  201. minLength: 1
  202. type: string
  203. required:
  204. - value
  205. type: object
  206. maxItems: 16
  207. type: array
  208. gatewayClassName:
  209. description: GatewayClassName used for this Gateway. This is the name of a GatewayClass resource.
  210. maxLength: 253
  211. minLength: 1
  212. type: string
  213. listeners:
  214. description: "Listeners associated with this Gateway. Listeners define logical endpoints that are bound on this Gateway's addresses. At least one Listener MUST be specified. \n An implementation MAY group Listeners by Port and then collapse each group of Listeners into a single Listener if the implementation determines that the Listeners in the group are \"compatible\". An implementation MAY also group together and collapse compatible Listeners belonging to different Gateways. \n For example, an implementation might consider Listeners to be compatible with each other if all of the following conditions are met: \n 1. Either each Listener within the group specifies the \"HTTP\" Protocol or each Listener within the group specifies either the \"HTTPS\" or \"TLS\" Protocol. \n 2. Each Listener within the group specifies a Hostname that is unique within the group. \n 3. As a special case, one Listener within a group may omit Hostname, in which case this Listener matches when no other Listener matches. \n If the implementation does collapse compatible Listeners, the hostname provided in the incoming client request MUST be matched to a Listener to find the correct set of Routes. The incoming hostname MUST be matched using the Hostname field for each Listener in order of most to least specific. That is, exact matches must be processed before wildcard matches. \n If this field specifies multiple Listeners that have the same Port value but are not compatible, the implementation must raise a \"Conflicted\" condition in the Listener status. \n Support: Core"
  215. items:
  216. description: Listener embodies the concept of a logical endpoint where a Gateway can accept network connections. Each listener in a Gateway must have a unique combination of Hostname, Port, and Protocol. This will be enforced by a validating webhook.
  217. properties:
  218. hostname:
  219. description: "Hostname specifies the virtual hostname to match for protocol types that define this concept. When unspecified or \"*\", all hostnames are matched. This field can be omitted for protocols that don't require hostname based matching. \n Hostname is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the \"host\" part of the URI as defined in the RFC: \n 1. IP literals are not allowed. 2. The `:` delimiter is not respected because ports are not allowed. \n Hostname can be \"precise\" which is a domain name without the terminating dot of a network host (e.g. \"foo.example.com\") or \"wildcard\", which is a domain name prefixed with a single wildcard label (e.g. \"*.example.com\"). The wildcard character '*' must appear by itself as the first DNS label and matches only a single label. \n Support: Core"
  220. maxLength: 253
  221. minLength: 1
  222. type: string
  223. port:
  224. description: "Port is the network port. Multiple listeners may use the same port, subject to the Listener compatibility rules. \n Support: Core"
  225. format: int32
  226. maximum: 65535
  227. minimum: 1
  228. type: integer
  229. protocol:
  230. description: "Protocol specifies the network protocol this listener expects to receive. The GatewayClass MUST apply the Hostname match appropriately for each protocol: \n * For the \"TLS\" protocol, the Hostname match MUST be applied to the [SNI](https://tools.ietf.org/html/rfc6066#section-3) server name offered by the client. * For the \"HTTP\" protocol, the Hostname match MUST be applied to the host portion of the [effective request URI](https://tools.ietf.org/html/rfc7230#section-5.5) or the [:authority pseudo-header](https://tools.ietf.org/html/rfc7540#section-8.1.2.3) * For the \"HTTPS\" protocol, the Hostname match MUST be applied at both the TLS and HTTP protocol layers. \n Support: Core"
  231. type: string
  232. routes:
  233. description: "Routes specifies a schema for associating routes with the Listener using selectors. A Route is a resource capable of servicing a request and allows a cluster operator to expose a cluster resource (i.e. Service) by externally-reachable URL, load-balance traffic and terminate SSL/TLS. Typically, a route is a \"HTTPRoute\" or \"TCPRoute\" in group \"networking.x-k8s.io\", however, an implementation may support other types of resources. \n The Routes selector MUST select a set of objects that are compatible with the application protocol specified in the Protocol field. \n Although a client request may technically match multiple route rules, only one rule may ultimately receive the request. Matching precedence MUST be determined in order of the following criteria: \n * The most specific match. For example, the most specific HTTPRoute match is determined by the longest matching combination of hostname and path. * The oldest Route based on creation timestamp. For example, a Route with a creation timestamp of \"2020-09-08 01:02:03\" is given precedence over a Route with a creation timestamp of \"2020-09-08 01:02:04\". * If everything else is equivalent, the Route appearing first in alphabetical order (namespace/name) should be given precedence. For example, foo/bar is given precedence over foo/baz. \n All valid portions of a Route selected by this field should be supported. Invalid portions of a Route can be ignored (sometimes that will mean the full Route). If a portion of a Route transitions from valid to invalid, support for that portion of the Route should be dropped to ensure consistency. For example, even if a filter specified by a Route is invalid, the rest of the Route should still be supported. \n Support: Core"
  234. properties:
  235. group:
  236. default: networking.x-k8s.io
  237. description: "Group is the group of the route resource to select. Omitting the value or specifying the empty string indicates the networking.x-k8s.io API group. For example, use the following to select an HTTPRoute: \n routes: kind: HTTPRoute \n Otherwise, if an alternative API group is desired, specify the desired group: \n routes: group: acme.io kind: FooRoute \n Support: Core"
  238. maxLength: 253
  239. minLength: 1
  240. type: string
  241. kind:
  242. description: "Kind is the kind of the route resource to select. \n Kind MUST correspond to kinds of routes that are compatible with the application protocol specified in the Listener's Protocol field. \n If an implementation does not support or recognize this resource type, it SHOULD raise a \"ConditionInvalidRoutes\" condition for the affected Listener. \n Support: Core"
  243. type: string
  244. namespaces:
  245. default:
  246. from: Same
  247. description: "Namespaces indicates in which namespaces Routes should be selected for this Gateway. This is restricted to the namespace of this Gateway by default. \n Support: Core"
  248. properties:
  249. from:
  250. description: "From indicates where Routes will be selected for this Gateway. Possible values are: * All: Routes in all namespaces may be used by this Gateway. * Selector: Routes in namespaces selected by the selector may be used by this Gateway. * Same: Only Routes in the same namespace may be used by this Gateway. \n Support: Core"
  251. enum:
  252. - All
  253. - Selector
  254. - Same
  255. type: string
  256. selector:
  257. description: "Selector must be specified when From is set to \"Selector\". In that case, only Routes in Namespaces matching this Selector will be selected by this Gateway. This field is ignored for other values of \"From\". \n Support: Core"
  258. properties:
  259. matchExpressions:
  260. description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
  261. items:
  262. description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
  263. properties:
  264. key:
  265. description: key is the label key that the selector applies to.
  266. type: string
  267. operator:
  268. description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
  269. type: string
  270. values:
  271. description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
  272. items:
  273. type: string
  274. type: array
  275. required:
  276. - key
  277. - operator
  278. type: object
  279. type: array
  280. matchLabels:
  281. additionalProperties:
  282. type: string
  283. description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
  284. type: object
  285. type: object
  286. type: object
  287. selector:
  288. description: "Selector specifies a set of route labels used for selecting routes to associate with the Gateway. If RouteSelector is defined, only routes matching the RouteSelector are associated with the Gateway. An empty RouteSelector matches all routes. \n Support: Core"
  289. properties:
  290. matchExpressions:
  291. description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
  292. items:
  293. description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
  294. properties:
  295. key:
  296. description: key is the label key that the selector applies to.
  297. type: string
  298. operator:
  299. description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
  300. type: string
  301. values:
  302. description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
  303. items:
  304. type: string
  305. type: array
  306. required:
  307. - key
  308. - operator
  309. type: object
  310. type: array
  311. matchLabels:
  312. additionalProperties:
  313. type: string
  314. description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
  315. type: object
  316. type: object
  317. required:
  318. - kind
  319. type: object
  320. tls:
  321. description: "TLS is the TLS configuration for the Listener. This field is required if the Protocol field is \"HTTPS\" or \"TLS\" and ignored otherwise. \n The association of SNIs to Certificate defined in GatewayTLSConfig is defined based on the Hostname field for this listener. \n The GatewayClass MUST use the longest matching SNI out of all available certificates for any TLS handshake. \n Support: Core"
  322. properties:
  323. certificateRef:
  324. description: 'CertificateRef is the reference to Kubernetes object that contain a TLS certificate and private key. This certificate MUST be used for TLS handshakes for the domain this GatewayTLSConfig is associated with. If an entry in this list omits or specifies the empty string for both the group and the resource, the resource defaults to "secrets". An implementation may support other resources (for example, resource "mycertificates" in group "networking.acme.io"). Support: Core (Kubernetes Secrets) Support: Implementation-specific (Other resource types)'
  325. properties:
  326. group:
  327. description: Group is the group of the referent.
  328. maxLength: 253
  329. minLength: 1
  330. type: string
  331. kind:
  332. description: Kind is kind of the referent.
  333. maxLength: 253
  334. minLength: 1
  335. type: string
  336. name:
  337. description: Name is the name of the referent.
  338. maxLength: 253
  339. minLength: 1
  340. type: string
  341. required:
  342. - group
  343. - kind
  344. - name
  345. type: object
  346. mode:
  347. description: 'Mode defines the TLS behavior for the TLS session initiated by the client. There are two possible modes: - Terminate: The TLS session between the downstream client and the Gateway is terminated at the Gateway. - Passthrough: The TLS session is NOT terminated by the Gateway. This implies that the Gateway can''t decipher the TLS stream except for the ClientHello message of the TLS protocol. CertificateRef field is ignored in this mode.'
  348. enum:
  349. - Terminate
  350. - Passthrough
  351. type: string
  352. options:
  353. additionalProperties:
  354. type: string
  355. description: "Options are a list of key/value pairs to give extended options to the provider. \n There variation among providers as to how ciphersuites are expressed. If there is a common subset for expressing ciphers then it will make sense to loft that as a core API construct. \n Support: Implementation-specific."
  356. type: object
  357. routeOverride:
  358. default:
  359. certificate: Deny
  360. description: "RouteOverride dictates if TLS settings can be configured via Routes or not. \n CertificateRef must be defined even if `routeOverride.certificate` is set to 'Allow' as it will be used as the default certificate for the listener."
  361. properties:
  362. certificate:
  363. default: Deny
  364. description: "Certificate dictates if TLS certificates can be configured via Routes. If set to 'Allow', a TLS certificate for a hostname defined in a Route takes precedence over the certificate defined in Gateway. \n Support: Core"
  365. enum:
  366. - Allow
  367. - Deny
  368. type: string
  369. required:
  370. - certificate
  371. type: object
  372. type: object
  373. required:
  374. - port
  375. - protocol
  376. - routes
  377. type: object
  378. maxItems: 64
  379. minItems: 1
  380. type: array
  381. required:
  382. - gatewayClassName
  383. - listeners
  384. type: object
  385. status:
  386. default:
  387. conditions:
  388. - lastTransitionTime: "1970-01-01T00:00:00Z"
  389. message: Waiting for controller
  390. reason: NotReconciled
  391. status: "False"
  392. type: Scheduled
  393. description: GatewayStatus defines the observed state of Gateway.
  394. properties:
  395. addresses:
  396. description: "Addresses lists the IP addresses that have actually been bound to the Gateway. These addresses may differ from the addresses in the Spec, e.g. if the Gateway automatically assigns an address from a reserved pool. \n These addresses should all be of type \"IPAddress\"."
  397. items:
  398. description: GatewayAddress describes an address that can be bound to a Gateway.
  399. properties:
  400. type:
  401. default: IPAddress
  402. description: "Type of the Address. This is either \"IPAddress\" or \"NamedAddress\". \n Support: Extended"
  403. enum:
  404. - IPAddress
  405. - NamedAddress
  406. type: string
  407. value:
  408. description: 'Value. Examples: "1.2.3.4", "128::1", "my-ip-address". Validity of the values will depend on `Type` and support by the controller.'
  409. maxLength: 253
  410. minLength: 1
  411. type: string
  412. required:
  413. - value
  414. type: object
  415. maxItems: 16
  416. type: array
  417. conditions:
  418. default:
  419. - lastTransitionTime: "1970-01-01T00:00:00Z"
  420. message: Waiting for controller
  421. reason: NotReconciled
  422. status: "False"
  423. type: Scheduled
  424. description: "Conditions describe the current conditions of the Gateway. \n Implementations should prefer to express Gateway conditions using the `GatewayConditionType` and `GatewayConditionReason` constants so that operators and tools can converge on a common vocabulary to describe Gateway state. \n Known condition types are: \n * \"Scheduled\" * \"Ready\""
  425. items:
  426. description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
  427. properties:
  428. lastTransitionTime:
  429. description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
  430. format: date-time
  431. type: string
  432. message:
  433. description: message is a human readable message indicating details about the transition. This may be an empty string.
  434. maxLength: 32768
  435. type: string
  436. observedGeneration:
  437. description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
  438. format: int64
  439. minimum: 0
  440. type: integer
  441. reason:
  442. description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
  443. maxLength: 1024
  444. minLength: 1
  445. pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
  446. type: string
  447. status:
  448. description: status of the condition, one of True, False, Unknown.
  449. enum:
  450. - "True"
  451. - "False"
  452. - Unknown
  453. type: string
  454. type:
  455. description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
  456. maxLength: 316
  457. pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
  458. type: string
  459. required:
  460. - lastTransitionTime
  461. - message
  462. - reason
  463. - status
  464. - type
  465. type: object
  466. maxItems: 8
  467. type: array
  468. x-kubernetes-list-map-keys:
  469. - type
  470. x-kubernetes-list-type: map
  471. listeners:
  472. description: Listeners provide status for each unique listener port defined in the Spec.
  473. items:
  474. description: ListenerStatus is the status associated with a Listener.
  475. properties:
  476. conditions:
  477. description: Conditions describe the current condition of this listener.
  478. items:
  479. description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
  480. properties:
  481. lastTransitionTime:
  482. description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
  483. format: date-time
  484. type: string
  485. message:
  486. description: message is a human readable message indicating details about the transition. This may be an empty string.
  487. maxLength: 32768
  488. type: string
  489. observedGeneration:
  490. description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
  491. format: int64
  492. minimum: 0
  493. type: integer
  494. reason:
  495. description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
  496. maxLength: 1024
  497. minLength: 1
  498. pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
  499. type: string
  500. status:
  501. description: status of the condition, one of True, False, Unknown.
  502. enum:
  503. - "True"
  504. - "False"
  505. - Unknown
  506. type: string
  507. type:
  508. description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
  509. maxLength: 316
  510. pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
  511. type: string
  512. required:
  513. - lastTransitionTime
  514. - message
  515. - reason
  516. - status
  517. - type
  518. type: object
  519. maxItems: 8
  520. type: array
  521. x-kubernetes-list-map-keys:
  522. - type
  523. x-kubernetes-list-type: map
  524. hostname:
  525. description: Hostname is the Listener hostname value for which this message is reporting the status.
  526. maxLength: 253
  527. minLength: 1
  528. type: string
  529. port:
  530. description: Port is the unique Listener port value for which this message is reporting the status.
  531. format: int32
  532. maximum: 65535
  533. minimum: 1
  534. type: integer
  535. protocol:
  536. description: Protocol is the Listener protocol value for which this message is reporting the status.
  537. type: string
  538. required:
  539. - conditions
  540. - port
  541. - protocol
  542. type: object
  543. maxItems: 64
  544. type: array
  545. x-kubernetes-list-map-keys:
  546. - port
  547. x-kubernetes-list-type: map
  548. type: object
  549. type: object
  550. served: true
  551. storage: true
  552. subresources:
  553. status: {}
  554. status:
  555. acceptedNames:
  556. kind: ""
  557. plural: ""
  558. conditions: []
  559. storedVersions: []
  560. ---
  561. apiVersion: apiextensions.k8s.io/v1
  562. kind: CustomResourceDefinition
  563. metadata:
  564. annotations:
  565. controller-gen.kubebuilder.io/version: v0.4.0
  566. creationTimestamp: null
  567. name: httproutes.networking.x-k8s.io
  568. spec:
  569. group: networking.x-k8s.io
  570. names:
  571. kind: HTTPRoute
  572. listKind: HTTPRouteList
  573. plural: httproutes
  574. singular: httproute
  575. scope: Namespaced
  576. versions:
  577. - additionalPrinterColumns:
  578. - jsonPath: .spec.hostnames
  579. name: Hostnames
  580. type: string
  581. name: v1alpha1
  582. schema:
  583. openAPIV3Schema:
  584. description: HTTPRoute is the Schema for the HTTPRoute resource.
  585. properties:
  586. apiVersion:
  587. description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
  588. type: string
  589. kind:
  590. description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
  591. type: string
  592. metadata:
  593. type: object
  594. spec:
  595. description: HTTPRouteSpec defines the desired state of HTTPRoute
  596. properties:
  597. gateways:
  598. default:
  599. allow: SameNamespace
  600. description: Gateways defines which Gateways can use this Route.
  601. properties:
  602. allow:
  603. default: SameNamespace
  604. description: 'Allow indicates which Gateways will be allowed to use this route. Possible values are: * All: Gateways in any namespace can use this route. * FromList: Only Gateways specified in GatewayRefs may use this route. * SameNamespace: Only Gateways in the same namespace may use this route.'
  605. enum:
  606. - All
  607. - FromList
  608. - SameNamespace
  609. type: string
  610. gatewayRefs:
  611. description: GatewayRefs must be specified when Allow is set to "FromList". In that case, only Gateways referenced in this list will be allowed to use this route. This field is ignored for other values of "Allow".
  612. items:
  613. description: GatewayReference identifies a Gateway in a specified namespace.
  614. properties:
  615. name:
  616. description: Name is the name of the referent.
  617. maxLength: 253
  618. minLength: 1
  619. type: string
  620. namespace:
  621. description: Namespace is the namespace of the referent.
  622. maxLength: 253
  623. minLength: 1
  624. type: string
  625. required:
  626. - name
  627. - namespace
  628. type: object
  629. type: array
  630. type: object
  631. hostnames:
  632. description: "Hostnames defines a set of hostname that should match against the HTTP Host header to select a HTTPRoute to process the request. Hostname is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the \"host\" part of the URI as defined in the RFC: \n 1. IPs are not allowed. 2. The `:` delimiter is not respected because ports are not allowed. \n Incoming requests are matched against the hostnames before the HTTPRoute rules. If no hostname is specified, traffic is routed based on the HTTPRouteRules. \n Hostname can be \"precise\" which is a domain name without the terminating dot of a network host (e.g. \"foo.example.com\") or \"wildcard\", which is a domain name prefixed with a single wildcard label (e.g. \"*.example.com\"). The wildcard character '*' must appear by itself as the first DNS label and matches only a single label. You cannot have a wildcard label by itself (e.g. Host == \"*\"). Requests will be matched against the Host field in the following order: 1. If Host is precise, the request matches this rule if the http host header is equal to Host. 2. If Host is a wildcard, then the request matches this rule if the http host header is to equal to the suffix (removing the first label) of the wildcard rule. \n Support: Core"
  633. items:
  634. description: Hostname is used to specify a hostname that should be matched.
  635. maxLength: 253
  636. minLength: 1
  637. type: string
  638. maxItems: 16
  639. type: array
  640. rules:
  641. description: Rules are a list of HTTP matchers, filters and actions.
  642. items:
  643. description: HTTPRouteRule defines semantics for matching an HTTP request based on conditions, optionally executing additional processing steps, and forwarding the request to an API object.
  644. properties:
  645. filters:
  646. description: "Filters define the filters that are applied to requests that match this rule. \n The effects of ordering of multiple behaviors are currently unspecified. This can change in the future based on feedback during the alpha stage. \n Conformance-levels at this level are defined based on the type of filter: - ALL core filters MUST be supported by all implementations. - Implementers are encouraged to support extended filters. - Implementation-specific custom filters have no API guarantees across implementations. \n Specifying a core filter multiple times has unspecified or custom conformance. \n Support: core"
  647. items:
  648. description: 'HTTPRouteFilter defines additional processing steps that must be completed during the request or response lifecycle. HTTPRouteFilters are meant as an extension point to express additional processing that may be done in Gateway implementations. Some examples include request or response modification, implementing authentication strategies, rate-limiting, and traffic shaping. API guarantee/conformance is defined based on the type of the filter. TODO(hbagdi): re-render CRDs once controller-tools supports union tags: - https://github.com/kubernetes-sigs/controller-tools/pull/298 - https://github.com/kubernetes-sigs/controller-tools/issues/461'
  649. properties:
  650. extensionRef:
  651. description: "ExtensionRef is an optional, implementation-specific extension to the \"filter\" behavior. For example, resource \"myroutefilter\" in group \"networking.acme.io\"). ExtensionRef MUST NOT be used for core and extended filters. \n Support: Implementation-specific"
  652. properties:
  653. group:
  654. description: Group is the group of the referent.
  655. maxLength: 253
  656. minLength: 1
  657. type: string
  658. kind:
  659. description: Kind is kind of the referent.
  660. maxLength: 253
  661. minLength: 1
  662. type: string
  663. name:
  664. description: Name is the name of the referent.
  665. maxLength: 253
  666. minLength: 1
  667. type: string
  668. required:
  669. - group
  670. - kind
  671. - name
  672. type: object
  673. requestHeaderModifier:
  674. description: "RequestHeaderModifier defines a schema for a filter that modifies request headers. \n Support: Core"
  675. properties:
  676. add:
  677. additionalProperties:
  678. type: string
  679. description: "Add adds the given header (name, value) to the request before the action. \n Input: GET /foo HTTP/1.1 \n Config: add: {\"my-header\": \"foo\"} \n Output: GET /foo HTTP/1.1 my-header: foo \n Support: Extended"
  680. type: object
  681. remove:
  682. description: "Remove the given header(s) from the HTTP request before the action. The value of RemoveHeader is a list of HTTP header names. Note that the header names are case-insensitive [RFC-2616 4.2]. \n Input: GET /foo HTTP/1.1 My-Header1: ABC My-Header2: DEF My-Header2: GHI \n Config: remove: [\"my-header1\", \"my-header3\"] \n Output: GET /foo HTTP/1.1 My-Header2: DEF \n Support: Extended"
  683. items:
  684. type: string
  685. maxItems: 16
  686. type: array
  687. type: object
  688. requestMirror:
  689. description: "RequestMirror defines a schema for a filter that mirrors requests. \n Support: Extended"
  690. properties:
  691. backendRef:
  692. description: "BackendRef is a local object reference to mirror matched requests to. If both BackendRef and ServiceName are specified, ServiceName will be given precedence. \n If the referent cannot be found, the rule is not included in the route. The controller should raise the \"ResolvedRefs\" condition on the Gateway with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n Support: Custom"
  693. properties:
  694. group:
  695. description: Group is the group of the referent.
  696. maxLength: 253
  697. minLength: 1
  698. type: string
  699. kind:
  700. description: Kind is kind of the referent.
  701. maxLength: 253
  702. minLength: 1
  703. type: string
  704. name:
  705. description: Name is the name of the referent.
  706. maxLength: 253
  707. minLength: 1
  708. type: string
  709. required:
  710. - group
  711. - kind
  712. - name
  713. type: object
  714. port:
  715. description: Port specifies the destination port number to use for the backend referenced by the ServiceName or BackendRef field.
  716. format: int32
  717. maximum: 65535
  718. minimum: 1
  719. type: integer
  720. serviceName:
  721. description: "ServiceName refers to the name of the Service to mirror matched requests to. When specified, this takes the place of BackendRef. If both BackendRef and ServiceName are specified, ServiceName will be given precedence. \n If the referent cannot be found, the rule is not included in the route. The controller should raise the \"ResolvedRefs\" condition on the Gateway with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n Support: Core"
  722. maxLength: 253
  723. type: string
  724. required:
  725. - port
  726. type: object
  727. type:
  728. description: "Type identifies the type of filter to apply. As with other API fields, types are classified into three conformance levels: \n - Core: Filter types and their corresponding configuration defined by \"Support: Core\" in this package, e.g. \"RequestHeaderModifier\". All implementations must support core filters. \n - Extended: Filter types and their corresponding configuration defined by \"Support: Extended\" in this package, e.g. \"RequestMirror\". Implementers are encouraged to support extended filters. \n - Custom: Filters that are defined and supported by specific vendors. In the future, filters showing convergence in behavior across multiple implementations will be considered for inclusion in extended or core conformance levels. Filter-specific configuration for such filters is specified using the ExtensionRef field. `Type` should be set to \"ExtensionRef\" for custom filters. \n Implementers are encouraged to define custom implementation types to extend the core API with implementation-specific behavior."
  729. enum:
  730. - RequestHeaderModifier
  731. - RequestMirror
  732. - ExtensionRef
  733. type: string
  734. required:
  735. - type
  736. type: object
  737. maxItems: 16
  738. type: array
  739. forwardTo:
  740. description: ForwardTo defines the backend(s) where matching requests should be sent. If unspecified, the rule performs no forwarding. If unspecified and no filters are specified that would result in a response being sent, a 503 error code is returned.
  741. items:
  742. description: HTTPRouteForwardTo defines how a HTTPRoute should forward a request.
  743. properties:
  744. backendRef:
  745. description: "BackendRef is a reference to a backend to forward matched requests to. If both BackendRef and ServiceName are specified, ServiceName will be given precedence. \n If the referent cannot be found, the route must be dropped from the Gateway. The controller should raise the \"ResolvedRefs\" condition on the Gateway with the \"DroppedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n Support: Custom"
  746. properties:
  747. group:
  748. description: Group is the group of the referent.
  749. maxLength: 253
  750. minLength: 1
  751. type: string
  752. kind:
  753. description: Kind is kind of the referent.
  754. maxLength: 253
  755. minLength: 1
  756. type: string
  757. name:
  758. description: Name is the name of the referent.
  759. maxLength: 253
  760. minLength: 1
  761. type: string
  762. required:
  763. - group
  764. - kind
  765. - name
  766. type: object
  767. filters:
  768. description: "Filters defined at this-level should be executed if and only if the request is being forwarded to the backend defined here. \n Support: Custom (For broader support of filters, use the Filters field in HTTPRouteRule.)"
  769. items:
  770. description: 'HTTPRouteFilter defines additional processing steps that must be completed during the request or response lifecycle. HTTPRouteFilters are meant as an extension point to express additional processing that may be done in Gateway implementations. Some examples include request or response modification, implementing authentication strategies, rate-limiting, and traffic shaping. API guarantee/conformance is defined based on the type of the filter. TODO(hbagdi): re-render CRDs once controller-tools supports union tags: - https://github.com/kubernetes-sigs/controller-tools/pull/298 - https://github.com/kubernetes-sigs/controller-tools/issues/461'
  771. properties:
  772. extensionRef:
  773. description: "ExtensionRef is an optional, implementation-specific extension to the \"filter\" behavior. For example, resource \"myroutefilter\" in group \"networking.acme.io\"). ExtensionRef MUST NOT be used for core and extended filters. \n Support: Implementation-specific"
  774. properties:
  775. group:
  776. description: Group is the group of the referent.
  777. maxLength: 253
  778. minLength: 1
  779. type: string
  780. kind:
  781. description: Kind is kind of the referent.
  782. maxLength: 253
  783. minLength: 1
  784. type: string
  785. name:
  786. description: Name is the name of the referent.
  787. maxLength: 253
  788. minLength: 1
  789. type: string
  790. required:
  791. - group
  792. - kind
  793. - name
  794. type: object
  795. requestHeaderModifier:
  796. description: "RequestHeaderModifier defines a schema for a filter that modifies request headers. \n Support: Core"
  797. properties:
  798. add:
  799. additionalProperties:
  800. type: string
  801. description: "Add adds the given header (name, value) to the request before the action. \n Input: GET /foo HTTP/1.1 \n Config: add: {\"my-header\": \"foo\"} \n Output: GET /foo HTTP/1.1 my-header: foo \n Support: Extended"
  802. type: object
  803. remove:
  804. description: "Remove the given header(s) from the HTTP request before the action. The value of RemoveHeader is a list of HTTP header names. Note that the header names are case-insensitive [RFC-2616 4.2]. \n Input: GET /foo HTTP/1.1 My-Header1: ABC My-Header2: DEF My-Header2: GHI \n Config: remove: [\"my-header1\", \"my-header3\"] \n Output: GET /foo HTTP/1.1 My-Header2: DEF \n Support: Extended"
  805. items:
  806. type: string
  807. maxItems: 16
  808. type: array
  809. type: object
  810. requestMirror:
  811. description: "RequestMirror defines a schema for a filter that mirrors requests. \n Support: Extended"
  812. properties:
  813. backendRef:
  814. description: "BackendRef is a local object reference to mirror matched requests to. If both BackendRef and ServiceName are specified, ServiceName will be given precedence. \n If the referent cannot be found, the rule is not included in the route. The controller should raise the \"ResolvedRefs\" condition on the Gateway with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n Support: Custom"
  815. properties:
  816. group:
  817. description: Group is the group of the referent.
  818. maxLength: 253
  819. minLength: 1
  820. type: string
  821. kind:
  822. description: Kind is kind of the referent.
  823. maxLength: 253
  824. minLength: 1
  825. type: string
  826. name:
  827. description: Name is the name of the referent.
  828. maxLength: 253
  829. minLength: 1
  830. type: string
  831. required:
  832. - group
  833. - kind
  834. - name
  835. type: object
  836. port:
  837. description: Port specifies the destination port number to use for the backend referenced by the ServiceName or BackendRef field.
  838. format: int32
  839. maximum: 65535
  840. minimum: 1
  841. type: integer
  842. serviceName:
  843. description: "ServiceName refers to the name of the Service to mirror matched requests to. When specified, this takes the place of BackendRef. If both BackendRef and ServiceName are specified, ServiceName will be given precedence. \n If the referent cannot be found, the rule is not included in the route. The controller should raise the \"ResolvedRefs\" condition on the Gateway with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n Support: Core"
  844. maxLength: 253
  845. type: string
  846. required:
  847. - port
  848. type: object
  849. type:
  850. description: "Type identifies the type of filter to apply. As with other API fields, types are classified into three conformance levels: \n - Core: Filter types and their corresponding configuration defined by \"Support: Core\" in this package, e.g. \"RequestHeaderModifier\". All implementations must support core filters. \n - Extended: Filter types and their corresponding configuration defined by \"Support: Extended\" in this package, e.g. \"RequestMirror\". Implementers are encouraged to support extended filters. \n - Custom: Filters that are defined and supported by specific vendors. In the future, filters showing convergence in behavior across multiple implementations will be considered for inclusion in extended or core conformance levels. Filter-specific configuration for such filters is specified using the ExtensionRef field. `Type` should be set to \"ExtensionRef\" for custom filters. \n Implementers are encouraged to define custom implementation types to extend the core API with implementation-specific behavior."
  851. enum:
  852. - RequestHeaderModifier
  853. - RequestMirror
  854. - ExtensionRef
  855. type: string
  856. required:
  857. - type
  858. type: object
  859. maxItems: 16
  860. type: array
  861. port:
  862. description: "Port specifies the destination port number to use for the backend referenced by the ServiceName or BackendRef field. \n Support: Core"
  863. format: int32
  864. maximum: 65535
  865. minimum: 1
  866. type: integer
  867. serviceName:
  868. description: "ServiceName refers to the name of the Service to forward matched requests to. When specified, this takes the place of BackendRef. If both BackendRef and ServiceName are specified, ServiceName will be given precedence. \n If the referent cannot be found, the route must be dropped from the Gateway. The controller should raise the \"ResolvedRefs\" condition on the Gateway with the \"DroppedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n The protocol to use should be specified with the AppProtocol field on Service resources. This field was introduced in Kubernetes 1.18. If using an earlier version of Kubernetes, a `networking.x-k8s.io/app-protocol` annotation on the BackendPolicy resource may be used to define the protocol. If the AppProtocol field is available, this annotation should not be used. The AppProtocol field, when populated, takes precedence over the annotation in the BackendPolicy resource. For custom backends, it is encouraged to add a semantically-equivalent field in the Custom Resource Definition. \n Support: Core"
  869. maxLength: 253
  870. type: string
  871. weight:
  872. default: 1
  873. description: "Weight specifies the proportion of HTTP requests forwarded to the backend referenced by the ServiceName or BackendRef field. This is computed as weight/(sum of all weights in this ForwardTo list). For non-zero values, there may be some epsilon from the exact proportion defined here depending on the precision an implementation supports. Weight is not a percentage and the sum of weights does not need to equal 100. \n If only one backend is specified and it has a weight greater than 0, 100% of the traffic is forwarded to that backend. If weight is set to 0, no traffic should be forwarded for this entry. If unspecified, weight defaults to 1. \n Support: Core"
  874. format: int32
  875. maximum: 1000000
  876. minimum: 0
  877. type: integer
  878. required:
  879. - port
  880. type: object
  881. maxItems: 4
  882. type: array
  883. matches:
  884. default:
  885. - path:
  886. type: Prefix
  887. value: /
  888. description: "Matches define conditions used for matching the rule against incoming HTTP requests. Each match is independent, i.e. this rule will be matched if **any** one of the matches is satisfied. \n For example, take the following matches configuration: \n ``` matches: - path: value: \"/foo\" headers: values: version: \"2\" - path: value: \"/v2/foo\" ``` \n For a request to match against this rule, a request should satisfy EITHER of the two conditions: \n - path prefixed with `/foo` AND contains the header `version: \"2\"` - path prefix of `/v2/foo` \n See the documentation for HTTPRouteMatch on how to specify multiple match conditions that should be ANDed together. \n If no matches are specified, the default is a prefix path match on \"/\", which has the effect of matching every HTTP request. \n A client request may match multiple HTTP route rules. Matching precedence MUST be determined in order of the following criteria, continuing on ties: * The longest matching hostname. * The longest matching path. * The largest number of header matches * The oldest Route based on creation timestamp. For example, a Route with a creation timestamp of \"2020-09-08 01:02:03\" is given precedence over a Route with a creation timestamp of \"2020-09-08 01:02:04\". * The Route appearing first in alphabetical order (namespace/name) for example, foo/bar is given precedence over foo/baz."
  889. items:
  890. description: "HTTPRouteMatch defines the predicate used to match requests to a given action. Multiple match types are ANDed together, i.e. the match will evaluate to true only if all conditions are satisfied. \n For example, the match below will match a HTTP request only if its path starts with `/foo` AND it contains the `version: \"1\"` header: \n ``` match: path: value: \"/foo\" headers: values: version: \"1\" ```"
  891. properties:
  892. extensionRef:
  893. description: "ExtensionRef is an optional, implementation-specific extension to the \"match\" behavior. For example, resource \"myroutematcher\" in group \"networking.acme.io\". If the referent cannot be found, the rule is not included in the route. The controller should raise the \"ResolvedRefs\" condition on the Gateway with the \"DegradedRoutes\" reason. The gateway status for this route should be updated with a condition that describes the error more specifically. \n Support: custom"
  894. properties:
  895. group:
  896. description: Group is the group of the referent.
  897. maxLength: 253
  898. minLength: 1
  899. type: string
  900. kind:
  901. description: Kind is kind of the referent.
  902. maxLength: 253
  903. minLength: 1
  904. type: string
  905. name:
  906. description: Name is the name of the referent.
  907. maxLength: 253
  908. minLength: 1
  909. type: string
  910. required:
  911. - group
  912. - kind
  913. - name
  914. type: object
  915. headers:
  916. description: Headers specifies a HTTP request header matcher.
  917. properties:
  918. type:
  919. default: Exact
  920. description: "Type specifies how to match against the value of the header. \n Support: core (Exact) Support: custom (RegularExpression, ImplementationSpecific) \n Since RegularExpression PathType has custom conformance, implementations can support POSIX, PCRE or any other dialects of regular expressions. Please read the implementation's documentation to determine the supported dialect. \n HTTP Header name matching MUST be case-insensitive (RFC 2616 - section 4.2)."
  921. enum:
  922. - Exact
  923. - RegularExpression
  924. - ImplementationSpecific
  925. type: string
  926. values:
  927. additionalProperties:
  928. type: string
  929. description: "Values is a map of HTTP Headers to be matched. It MUST contain at least one entry. \n The HTTP header field name to match is the map key, and the value of the HTTP header is the map value. HTTP header field name matching MUST be case-insensitive. \n Multiple match values are ANDed together, meaning, a request must match all the specified headers to select the route."
  930. type: object
  931. required:
  932. - values
  933. type: object
  934. path:
  935. default:
  936. type: Prefix
  937. value: /
  938. description: Path specifies a HTTP request path matcher. If this field is not specified, a default prefix match on the "/" path is provided.
  939. properties:
  940. type:
  941. default: Prefix
  942. description: "Type specifies how to match against the path Value. \n Support: core (Exact, Prefix) Support: custom (RegularExpression, ImplementationSpecific) \n Since RegularExpression PathType has custom conformance, implementations can support POSIX, PCRE or any other dialects of regular expressions. Please read the implementation's documentation to determine the supported dialect."
  943. enum:
  944. - Exact
  945. - Prefix
  946. - RegularExpression
  947. - ImplementationSpecific
  948. type: string
  949. value:
  950. description: Value of the HTTP path to match against.
  951. minLength: 1
  952. type: string
  953. required:
  954. - value
  955. type: object
  956. type: object
  957. maxItems: 8
  958. type: array
  959. type: object
  960. maxItems: 16
  961. minItems: 1
  962. type: array
  963. tls:
  964. description: "TLS defines the TLS certificate to use for Hostnames defined in this Route. This configuration only takes effect if the AllowRouteOverride field is set to true in the associated Gateway resource. \n Collisions can happen if multiple HTTPRoutes define a TLS certificate for the same hostname. In such a case, conflict resolution guiding principles apply, specificallly, if hostnames are same and two different certificates are specified then the certificate in the oldest resource wins. \n Please note that HTTP Route-selection takes place after the TLS Handshake (ClientHello). Due to this, TLS certificate defined here will take precedence even if the request has the potential to match multiple routes (in case multiple HTTPRoutes share the same hostname). \n Support: Core"
  965. properties:
  966. certificateRef:
  967. description: 'CertificateRef refers to a Kubernetes object that contains a TLS certificate and private key. This certificate MUST be used for TLS handshakes for the domain this RouteTLSConfig is associated with. If an entry in this list omits or specifies the empty string for both the group and kind, the resource defaults to "secrets". An implementation may support other resources (for example, resource "mycertificates" in group "networking.acme.io"). Support: Core (Kubernetes Secrets) Support: Implementation-specific (Other resource types)'
  968. properties:
  969. group:
  970. description: Group is the group of the referent.
  971. maxLength: 253
  972. minLength: 1
  973. type: string
  974. kind:
  975. description: Kind is kind of the referent.
  976. maxLength: 253
  977. minLength: 1
  978. type: string
  979. name:
  980. description: Name is the name of the referent.
  981. maxLength: 253
  982. minLength: 1
  983. type: string
  984. required:
  985. - group
  986. - kind
  987. - name
  988. type: object
  989. required:
  990. - certificateRef
  991. type: object
  992. required:
  993. - rules
  994. type: object
  995. status:
  996. description: HTTPRouteStatus defines the observed state of HTTPRoute.
  997. properties:
  998. gateways:
  999. description: "Gateways is a list of the Gateways that are associated with the route, and the status of the route with respect to each of these Gateways. When a Gateway selects this route, the controller that manages the Gateway should add an entry to this list when the controller first sees the route and should update the entry as appropriate when the route is modified. \n A maximum of 100 Gateways will be represented in this list. If this list is full, there may be additional Gateways using this Route that are not included in the list."
  1000. items:
  1001. description: RouteGatewayStatus describes the status of a route with respect to an associated Gateway.
  1002. properties:
  1003. conditions:
  1004. description: Conditions describes the status of the route with respect to the Gateway. For example, the "Admitted" condition indicates whether the route has been admitted or rejected by the Gateway, and why. Note that the route's availability is also subject to the Gateway's own status conditions and listener status.
  1005. items:
  1006. description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
  1007. properties:
  1008. lastTransitionTime:
  1009. description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
  1010. format: date-time
  1011. type: string
  1012. message:
  1013. description: message is a human readable message indicating details about the transition. This may be an empty string.
  1014. maxLength: 32768
  1015. type: string
  1016. observedGeneration:
  1017. description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
  1018. format: int64
  1019. minimum: 0
  1020. type: integer
  1021. reason:
  1022. description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
  1023. maxLength: 1024
  1024. minLength: 1
  1025. pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
  1026. type: string
  1027. status:
  1028. description: status of the condition, one of True, False, Unknown.
  1029. enum:
  1030. - "True"
  1031. - "False"
  1032. - Unknown
  1033. type: string
  1034. type:
  1035. description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
  1036. maxLength: 316
  1037. pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
  1038. type: string
  1039. required:
  1040. - lastTransitionTime
  1041. - message
  1042. - reason
  1043. - status
  1044. - type
  1045. type: object
  1046. maxItems: 8
  1047. type: array
  1048. x-kubernetes-list-map-keys:
  1049. - type
  1050. x-kubernetes-list-type: map
  1051. gatewayRef:
  1052. description: GatewayRef is a reference to a Gateway object that is associated with the route.
  1053. properties:
  1054. name:
  1055. description: Name is the name of the referent.
  1056. maxLength: 253
  1057. minLength: 1
  1058. type: string
  1059. namespace:
  1060. description: Namespace is the namespace of the referent.
  1061. maxLength: 253
  1062. minLength: 1
  1063. type: string
  1064. required:
  1065. - name
  1066. - namespace
  1067. type: object
  1068. required:
  1069. - gatewayRef
  1070. type: object
  1071. maxItems: 100
  1072. type: array
  1073. required:
  1074. - gateways
  1075. type: object
  1076. type: object
  1077. served: true
  1078. storage: true
  1079. subresources:
  1080. status: {}
  1081. status:
  1082. acceptedNames:
  1083. kind: ""
  1084. plural: ""
  1085. conditions: []
  1086. storedVersions: []

RBAC

  1. ---
  2. apiVersion: rbac.authorization.k8s.io/v1
  3. kind: ClusterRole
  4. metadata:
  5. name: gateway-role
  6. rules:
  7. - apiGroups:
  8. - ""
  9. resources:
  10. - services
  11. - endpoints
  12. - secrets
  13. verbs:
  14. - get
  15. - list
  16. - watch
  17. - apiGroups:
  18. - networking.x-k8s.io
  19. resources:
  20. - gatewayclasses
  21. - gateways
  22. - httproutes
  23. verbs:
  24. - get
  25. - list
  26. - watch
  27. - apiGroups:
  28. - networking.x-k8s.io
  29. resources:
  30. - gatewayclasses/status
  31. - gateways/status
  32. - httproutes/status
  33. verbs:
  34. - update
  35. ---
  36. kind: ClusterRoleBinding
  37. apiVersion: rbac.authorization.k8s.io/v1beta1
  38. metadata:
  39. name: gateway-controller
  40. roleRef:
  41. apiGroup: rbac.authorization.k8s.io
  42. kind: ClusterRole
  43. name: gateway-role
  44. subjects:
  45. - kind: ServiceAccount
  46. name: traefik-controller
  47. namespace: default

The Kubernetes Service APIs provides several guides of how to use their API. Those guides will help you to go further than the example above. The getting started show you how to install the CRDs from their repository. Thus, keep in mind that the Traefik Gateway provider only supports the v0.1.0.

For now, the Traefik Gateway Provider could be used to achieve the following set-up guides:

Resource Configuration

When using Kubernetes Gateway API as a provider, Traefik uses Kubernetes Custom Resource Definition to retrieve its routing configuration.

All concepts can be found in the official API concepts documentation. Traefik implements the following resources:

  • GatewayClass defines a set of Gateways that share a common configuration and behaviour.
  • Gateway describes how traffic can be translated to Services within the cluster.
  • HTTPRoute define HTTP rules for mapping requests from a Gateway to Kubernetes Services.

Provider Configuration

endpoint

Optional, Default=empty

File (TOML)

  1. [providers.kubernetesGateway]
  2. endpoint = "http://localhost:8080"
  3. # ...

File (YAML)

  1. providers:
  2. kubernetesGateway:
  3. endpoint: "http://localhost:8080"
  4. # ...

CLI

  1. --providers.kubernetesgateway.endpoint=http://localhost:8080

The Kubernetes server endpoint as URL.

When deployed into Kubernetes, Traefik will read the environment variables KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT or KUBECONFIG to construct the endpoint.

The access token will be looked up in /var/run/secrets/kubernetes.io/serviceaccount/token and the SSL CA certificate in /var/run/secrets/kubernetes.io/serviceaccount/ca.crt. Both are mounted automatically when deployed inside Kubernetes.

The endpoint may be specified to override the environment variable values inside a cluster.

When the environment variables are not found, Traefik will try to connect to the Kubernetes API server with an external-cluster client. In this case, the endpoint is required. Specifically, it may be set to the URL used by kubectl proxy to connect to a Kubernetes cluster using the granted authentication and authorization of the associated kubeconfig.

token

Optional, Default=empty

File (TOML)

  1. [providers.kubernetesGateway]
  2. token = "mytoken"
  3. # ...

File (YAML)

  1. providers:
  2. kubernetesGateway:
  3. token: "mytoken"
  4. # ...

CLI

  1. --providers.kubernetesgateway.token=mytoken

Bearer token used for the Kubernetes client configuration.

certAuthFilePath

Optional, Default=empty

File (TOML)

  1. [providers.kubernetesGateway]
  2. certAuthFilePath = "/my/ca.crt"
  3. # ...

File (YAML)

  1. providers:
  2. kubernetesGateway:
  3. certAuthFilePath: "/my/ca.crt"
  4. # ...

CLI

  1. --providers.kubernetesgateway.certauthfilepath=/my/ca.crt

Path to the certificate authority file. Used for the Kubernetes client configuration.

namespaces

Optional, Default: all namespaces (empty array)

File (TOML)

  1. [providers.kubernetesGateway]
  2. namespaces = ["default", "production"]
  3. # ...

File (YAML)

  1. providers:
  2. kubernetesGateway:
  3. namespaces:
  4. - "default"
  5. - "production"
  6. # ...

CLI

  1. --providers.kubernetesgateway.namespaces=default,production

Array of namespaces to watch.

labelselector

Optional, Default: empty (process all resources)

File (TOML)

  1. [providers.kubernetesGateway]
  2. labelselector = "app=traefik"
  3. # ...

File (YAML)

  1. providers:
  2. kubernetesGateway:
  3. labelselector: "app=traefik"
  4. # ...

CLI

  1. --providers.kubernetesgateway.labelselector="app=traefik"

By default, Traefik processes all resource objects in the configured namespaces. A label selector can be defined to filter on specific GatewayClass objects only.

See label-selectors for details.

throttleDuration

Optional, Default: 0 (no throttling)

File (TOML)

  1. [providers.kubernetesGateway]
  2. throttleDuration = "10s"
  3. # ...

File (YAML)

  1. providers:
  2. kubernetesGateway:
  3. throttleDuration: "10s"
  4. # ...

CLI

  1. --providers.kubernetesgateway.throttleDuration=10s