Skip to content

Commit 2eb640a

Browse files
authored
feat(providers)!: improve kubernetesGateway and Gateway API support
1 parent 7d3a90d commit 2eb640a

28 files changed

+6571
-108
lines changed

EXAMPLES.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,3 +802,77 @@ metrics:
802802
summary: "Traefik Down"
803803
description: "{{ $labels.pod }} on {{ $labels.nodename }} is down"
804804
```
805+
806+
# Use kubernetes Gateway API
807+
808+
One can use the new stable kubernetes gateway API provider setting the following _values_:
809+
810+
```yaml
811+
image:
812+
tag: v3.1.0-rc3
813+
providers:
814+
kubernetesGateway:
815+
enabled: true
816+
```
817+
818+
<details>
819+
820+
<summary>With those values, a whoami service can be exposed with a HTTPRoute</summary>
821+
822+
```yaml
823+
---
824+
apiVersion: apps/v1
825+
kind: Deployment
826+
metadata:
827+
name: whoami
828+
spec:
829+
replicas: 2
830+
selector:
831+
matchLabels:
832+
app: whoami
833+
template:
834+
metadata:
835+
labels:
836+
app: whoami
837+
spec:
838+
containers:
839+
- name: whoami
840+
image: traefik/whoami
841+
842+
---
843+
apiVersion: v1
844+
kind: Service
845+
metadata:
846+
name: whoami
847+
spec:
848+
selector:
849+
app: whoami
850+
ports:
851+
- protocol: TCP
852+
port: 80
853+
854+
---
855+
apiVersion: gateway.networking.k8s.io/v1
856+
kind: HTTPRoute
857+
metadata:
858+
name: whoami
859+
spec:
860+
parentRefs:
861+
- name: traefik-gateway
862+
hostnames:
863+
- whoami.docker.localhost
864+
rules:
865+
- matches:
866+
- path:
867+
type: Exact
868+
value: /
869+
870+
backendRefs:
871+
- name: whoami
872+
port: 80
873+
weight: 1
874+
```
875+
876+
Once it's applied, whoami should be accessible on http://whoami.docker.localhost/
877+
878+
</details>

traefik/VALUES.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ Kubernetes: `>=1.22.0-0`
5858
| experimental.kubernetesGateway.enabled | bool | `false` | Enable traefik experimental GatewayClass CRD |
5959
| experimental.plugins | object | `{}` | Enable traefik experimental plugins |
6060
| extraObjects | list | `[]` | Extra objects to deploy (value evaluated as a template) In some cases, it can avoid the need for additional, extended or adhoc deployments. See #595 for more details and traefik/tests/values/extra.yaml for example. |
61+
| gateway.annotations | string | `nil` | Additional gateway annotations (e.g. for cert-manager.io/issuer) |
62+
| gateway.certificateRefs | string | `nil` | See [GatewayTLSConfig](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.GatewayTLSConfig) |
63+
| gateway.enabled | bool | `true` | When providers.kubernetesGateway.enabled, deploy a default gateway |
64+
| gateway.name | string | `nil` | Set a custom name to gateway |
65+
| gateway.namespace | string | `nil` | By default, Gateway is created in the same `Namespace` than Traefik. |
66+
| gateway.namespacePolicy | string | `nil` | Routes are restricted to namespace of the gateway [by default](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.FromNamespaces) |
67+
| gatewayClass.enabled | bool | `true` | When providers.kubernetesGateway.enabled and gateway.enabled, deploy a default gatewayClass |
68+
| gatewayClass.labels | string | `nil` | Additional gatewayClass labels (e.g. for filtering gateway objects by custom labels) |
69+
| gatewayClass.name | string | `nil` | Set a custom name to GatewayClass |
6170
| globalArguments | list | `["--global.checknewversion","--global.sendanonymoususage"]` | Global command arguments to be passed to all traefik's pods |
6271
| hostNetwork | bool | `false` | If hostNetwork is true, runs traefik in the host network namespace To prevent unschedulabel pods due to port collisions, if hostNetwork=true and replicas>1, a pod anti-affinity is recommended and will be set if the affinity is left as default. |
6372
| hub.apimanagement.admission.listenAddr | string | `nil` | WebHook admission server listen address. Default: "0.0.0.0:9943". |
@@ -201,12 +210,18 @@ Kubernetes: `>=1.22.0-0`
201210
| providers.kubernetesCRD.enabled | bool | `true` | Load Kubernetes IngressRoute provider |
202211
| providers.kubernetesCRD.ingressClass | string | `nil` | When the parameter is set, only resources containing an annotation with the same value are processed. Otherwise, resources missing the annotation, having an empty value, or the value traefik are processed. It will also set required annotation on Dashboard and Healthcheck IngressRoute when enabled. |
203212
| providers.kubernetesCRD.namespaces | list | `[]` | Array of namespaces to watch. If left empty, Traefik watches all namespaces. |
213+
| providers.kubernetesCRD.nativeLBByDefault | string | `nil` | Defines whether to use Native Kubernetes load-balancing mode by default. |
214+
| providers.kubernetesGateway.enabled | bool | `false` | Enable Traefik Gateway provider for Gateway API |
215+
| providers.kubernetesGateway.experimentalChannel | bool | `false` | Toggles support for the Experimental Channel resources (Gateway API release channels documentation). This option currently enables support for TCPRoute and TLSRoute. |
216+
| providers.kubernetesGateway.labelselector | string | `nil` | A label selector can be defined to filter on specific GatewayClass objects only. |
217+
| providers.kubernetesGateway.namespaces | list | `[]` | Array of namespaces to watch. If left empty, Traefik watches all namespaces. |
204218
| providers.kubernetesIngress.allowEmptyServices | bool | `false` | Allows to return 503 when there is no endpoints available |
205219
| providers.kubernetesIngress.allowExternalNameServices | bool | `false` | Allows to reference ExternalName services in Ingress |
206220
| providers.kubernetesIngress.disableIngressClassLookup | bool | `false` | |
207221
| providers.kubernetesIngress.enabled | bool | `true` | Load Kubernetes Ingress provider |
208222
| providers.kubernetesIngress.ingressClass | string | `nil` | When ingressClass is set, only Ingresses containing an annotation with the same value are processed. Otherwise, Ingresses missing the annotation, having an empty value, or the value traefik are processed. |
209223
| providers.kubernetesIngress.namespaces | list | `[]` | Array of namespaces to watch. If left empty, Traefik watches all namespaces. |
224+
| providers.kubernetesIngress.nativeLBByDefault | string | `nil` | Defines whether to use Native Kubernetes load-balancing mode by default. |
210225
| providers.kubernetesIngress.publishedService.enabled | bool | `false` | |
211226
| rbac | object | `{"enabled":true,"namespaced":false,"secretResourceNames":[]}` | Whether Role Based Access Control objects like roles and rolebindings should be created |
212227
| readinessProbe.failureThreshold | int | `1` | The number of consecutive failures allowed before considering the probe as failed. |

0 commit comments

Comments
 (0)