Using helm deployed traefik v2 to load balance external services

Hello,

I'm trying to figure out a way to use my k8s managed traefik v2 instance (deployed with the latest helm chart) to load balance servers outside the cluster. Now I don't really understand what ExternalName services are, but I already created vanilla services without selectors and specifying endpoints manually. However I would like for traefik to use its own health probes as these services are external and therefore do not have any liveness probes or whatnot.

According to the documentation:

The Traefik health check is not available for kubernetesCRD and kubernetesIngress providers because Kubernetes already has a health check mechanism. Unhealthy pods will be removed by kubernetes. (cf [liveness documentation](https://kubernetes.io/docs/tasks/configure-pod container/configure-liveness-readiness-startup-probes/#define-a-liveness-http-request))

So my question is can I use CRDS and the file provider to configure load balancing services using a helm deployed traefik v2? Or is there another solution to load balancing with these legacy services?

hello @neuromantik33

Yes, you can use File provider and create dynamic configuration using file. The dynamic configuration will be kept in Kubernetes ConfigMap object. In the config file you add a routing manually to the legacy services. Here is the link to the values.yaml where you can configure it according your needs:

I hope that helps.
Jakub

Thank you for your reply. Yes I figured it out by adding the file provider, however I noticed that the watch feature doesn't work with mounted configmaps for some reason. So I ended up using kustomize's configmapgenerator to generate a new configmap and redeploy after each change. It's good to know though that different providers can work alongside together without much hassle.

I was afraid for a moment that one excluded the other, the way static configuration can only be by cli or env vars or yaml/toml, but not a mix of the 3, which for some configuration is too bad as the cli that helm uses it simply too verbose IMHO.

Hello @neuromantik33

ConfigMapGenerator from Kustomize is also a great feature especially when you deployed Traefik through Helm. I use it also that approach with Flux - works like a charm.

Regarding the different types of configuration, as you mentioned there are 3 types of them: config files, CLI, and env variables. However, they are mutually exclusive - that means that you can use only one at the same time.

https://doc.traefik.io/traefik/getting-started/configuration-overview/#the-static-configuration