How to get an IP Address for Gateway API?

I have a cluster of Raspberry PIs running K3s, Cilium (CNI, LB, kube-proxy). If I use Cilium or Contour as a Gateway API, I get an IP address for the gateway. How can I do it with Traefik v3.1.2?

$ kubectl get gateways -A
NAMESPACE     NAME              CLASS     ADDRESS          PROGRAMMED   AGE
cnpg-tools    cnpg-tools-gw     traefik                    True         44s
kube-system   hubble-gateway    cilium    192.168.72.160   True         5m27s
rook-ceph     rook-ceph         contour   192.168.72.161   True         5m23s
traefik       traefik-gateway   traefik                    True         6m24s

I am installing Traefik from Helm using Ansible, like this:

- name: Install traefik from chart
  kubernetes.core.helm:
    wait: true
    name: traefik
    chart_ref: traefik/traefik
    release_namespace: traefik
    chart_version: "{{ releases['traefik'] }}"
    values:
      image:
        tag: "{{ releases['traefik_tag'] }}"
      persistence:
        enabled: true
        storageClass: "rook-ceph-block"
      ingressRoute:
        dashboard:
          enabled: false
      ports:
        web:
          port: 80
        websecure:
          port: 443
        redis:
          port: 6379
        postgres:
          port: 5432
        ssh:
          port: 22
      additionalArguments:
        - "--entryPoints.web.http.redirections.entryPoint.to=websecure"
        - "--entryPoints.web.http.redirections.entryPoint.scheme=https"
        - "--log.level=DEBUG"
      providers:
        kubernetesIngress:
          enabled: false
        kubernetesGateway:
          enabled: true
          experimentalChannel: true
      gateway:
        enabled: false
      service:
        enabled: false

If I enable the service, the gateway is accessible via the LB created by the service, but the IP address does not show, nor is it registered with external DNS like the other options I am using.

Thank you!

Stefanita Vilcu

Maybe check this post.

I suspect, this is simply not something traefik manages. Cillium is full blown virtual network implementation, and as such it is expected to mange IP addresses, traefik is not. You will have to connect the pod to an ip address yourself. It should not be any different from how it's done for any other pods.

In my installation, Cilium acts as a load balancer. Exactly like MetalLB, it provides IP addresses to whoever asks. As I illustrated in my post, it can provide an IP address to the Project Contour Gateway Provisioner or a Cilium gateway, probably to Kong (I did not try it) or anything else. Unfortunately, Cilium gateway implementation does not support TCPRoute.
My problem is that Traefik is not asking for an IP address for the gateway to the LB as it is doing for the service.

Hey a bit late here but wanted to chime in for anyone that runs into this.

There are many ways to connect your Traefik to the outside world (i.e. make it accessible via a one or more node's ports' or via IP provided by something that satisfies LoadBalancer services) -- so the answer to this question varies.

If you're using an external IP provisioner (Cilium, MetalLB, etc), one way to get this working is to copy the assigned external IP to the service that will route traffic to Traefik. The configuration for this is (in TOML speak) providers.kubernetesGateway.statusAddress.service. IIRC this will support multiple external addresses for the gateway as well.

If you use Traefik with host ports + hostNetwork or nodePort`, this doesn't apply -- I'm not sure it makes any sense to assign the address in that case (outside of just doing it manually or something), but routing traffic will still work just fine (you can effectively ignore the missing address).