Charmed ingress on k8s with Traefik and Traefik-Route

The traefik charm is a charm to provide ingress to another charmed application ‘the juju way’. The idea is that if a charm integrates with traefik-k8s then you can relate the two applications and your application will receive the url at which ingress is made available.

The traefik charm supports two standardized interfaces:

  • ingress

    Using this interface, each charmed application can request a single, cluster-unique url for ingress. You can choose between a domain-name-based url ( and a path-based url (\your\parameters).

  • ingress-per-unit

    Using this interface, each charmed application can request a cluster-unique url for each existing unit. This is for applications such as prometheus, where each remote-write endpoint needs to be routed to separately, and database applications who wish to do client-side load-balancing.


The traefik route charm is a proxy charm that sits between traefik and a charm in need of ingress, and is used to provide low-level access to traefik configuration, as well as to allow per-relation configuration.

Want to have full access to all the expressive power of traefik’s routing configuration? Want to have one traefik instance, and provide domain-name-based url routing to some charms, but path-based url routing to some others? This is how you do it.

How to add ingress to your charm by integrating with traefik

Step by step, we look at a concrete use case and show how we added ingress to zinc-k8s.


Congratulations for Charmed ingress on k8s.

I think now maybe I can get access to applications without Nginx Ingress.

I’m on Microk8s/Aws and for

juju deploy traefik-k8s --to 0

the return is:

hook failed: “storage-attached”

In the log appears:

File “/var/lib/juju/agents/unit-traefik-k8s-1/charm/lib/charms/observability_libs/v0/”, line 279, in _namespace with open("/var/run/secrets/", “r”) as f: FileNotFoundError: [Errno 2] No such file or directory: ‘/var/run/secrets/’ unit-traefik-k8s-1: 13:16:49 ERROR juju.worker.uniter.operation hook “configurations-storage-attached” (via hook dispatching script: dispatch) failed: exit status 1 unit-traefik-k8s-1: 13:16:49 INFO juju.worker.uniter awaiting error resolution for “storage-attached” hook

I also tried juju deploy from zinc-k8s and it returned the same error.

I am using cStor openebs for PVC in addition to the Microk8s default volumes configuration.

What can I do to get out of this impasse, @ppasotti ?

Thanks if you can answer

Ah, just noticed the discussion is also going on here. Let’s move.

1 Like

Oi, @ppasotti

I am very grateful for your comments regarding the error I presented when deploying Traefik. You were sharp and finely tuned, and completely correct. And it made me see that I was indeed outside the K8s environment, although in the public cloud. But, I see that the volume problem was also reported in another issue. And now that I’ve corrected myself, I’m going to try to deploy it again, despite being easier with Nginx. Success, @ppasotti :clap:

Good luck deploying traefik on k8s! And thanks for the kind words :slight_smile:

1 Like