Search code examples
traefiktraefik-ingress

how ingressroute is hooked up to traefik's ingress contoller


I am learning traefik and ingressroute. One thing confused me the most is how the two parts are connected together.

After deploying traefik and my own service, I can simply create the following ingressroute to make it work:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: my-service-ir
  namespace: my-service-ns
spec:
  entryPoints:
    - web
  routes:
  - match: Path(`/`)
    kind: Rule
    services:
    - name: my-service
      port: 8000

But the ingressroute has nothing shared with traefik: not in the same namespace, no selector, etc.. It seems to me that the ingressroute can magically find traefik and apply on traefik. I am curious what happened behind it.

Thanks


Solution

  • When you deploy traefik in the kubernetes cluster, you use the rbac-k8s manifests like here. If you use helm then these are all present under that hood.

    These RBACs actually create the new resource types i.e. IngressRoute over here. They are applied at cluster level as you see in the link ClusterRole. This gives them ClusterLevel privileges. This is the reason you don't see anything special in the namespace.

    You can checkout the sample task here which will give some more light on the matter.