apiVersion: gateway.networking.k8s.io/v1alpha2
kind: GatewayClass
metadata:
name: my-gateway-class
spec:
# Controller is a domain/path string that indicates
# the controller that is managing Gateways of this class.
controllerName: traefik.io/gateway-controller
I'm using k3s. This version of kubernetes already includes Traefik 2.6, but when looking at kubectl describe deploy traefik, neither --experimental.kubernetesgateway=true, --providers.kubernetesgateway=true nor --experimental.kubernetesGateway.enabled=true is set. I got the first two keys from traefik gateway api documentation for version 2.6, and the last key from traefik's getting started blog post. I tried to do kubectl patch deploy traefik --patch-file=... with this file
However, I got an error saying Error from server: map: map[args:[--experimental.kubernetesGateway.enabled=true]] does not contain declared merge key: name. I don't know enough about patching that I'm able to solve this on my own.
In the output of docker run traefik:v2.6 --help I see this commandline argument
--experimental.kubernetesgateway (Default: "false")
Allow the Kubernetes gateway api provider usage.
...
--providers.kubernetesgateway (Default: "false")
Enable Kubernetes gateway api provider with default settings.
So it seems like that's the only command line arguments you need to pass to enable the gateway api. The way I updated the configuration is by kubectl describe deploy traefik (reminding the reader that I'm using k3s) and I pasted the output to a new yaml file and deleted the status key entirely. Then I added the two keys above to the args section, and ran kubectl delete deploy traefik then kubectl apply -f <yamlfile>. Now the new traefik deployment runs with the two arguments.
However, this didn't solve the problem. 16 minutes after applying but still Message: Waiting for controller.