Best Kubernetes configuration


I'm a newbie in Traefik configuration. I successfully configured Traefik to route some test services on Docker, including LetsEncrypt certificates.

Now I need to migrate this configuration to my on-premise Kubernetes cluster, but I'm not sure which configuration to choose. There are Kubernetes IngressRoute, Kubernetes Ingress, Kubernetes GatewayAPI options in the Traefik documentation:

  • The GatewayAPI is experimental so it dropped out from my R&D.
  • The IngressRoute is compatible with Kubernetes v.1.16. I got an error message customresourcedefinition is deprecated in v1.16+ unavailable in v1.22+

The current Kubernetes version is 1.21, The version 1.16 was issued in 2019... I tried to fix the error which Kubernetes responded after deploying the example code from the documentation, but I got another errors..

  • The Ingress example looks much better, but I couldn't find how I can apply dynamic configuration to the apps so they can be automatically handled by Traefik. As I can see in the Ingress component, the routing is hard-coded:
kind: Ingress
apiVersion: extensions/v1beta1
  name: "foo"
  namespace: production
    - host:
          - path: /bar
              serviceName: service1
              servicePort: 80
          - path: /foo
              serviceName: service1
              servicePort: 80

The sample above is part of Traefik documentation, not compatible with the current Kubernetes but after some refactoring it works.
I also testes some Helm charts to install all required components, but there were a lot of warnings and error again.

My questions are:

  1. Which is the best Kubernetes configuration?
  2. Are there any good tutorial, blog post or working sample yaml files, where I could find all steps and configurations on Traefik and Ingress side as well as on the applications side?
    I hope there are any available. I couldn't find how to configure Traefik in the Traefik documentation :frowning_face:

Hello @Hades,

  1. Which is the best Kubernetes configuration?

As you have noticed, there are many different ways to configure Traefik to route requests. Ingress is the "simplest" method to route requests in kubernetes, as it is a kubernetes-native object. If you are wondering how it works, the kubernetes documentation does a good job of explaining it: (Ingress | Kubernetes). We do not duplicate their documentation, as it would just become disjointed.

As kubernetes is an expansive and multi-layered orchestration platform, there are many different ways to accomplish the same goal. As such, there are many ways to configure Traefik to exhibit the same behaviour.

IngressRoute is a custom resource that exposes more configuration options than Ingress does, and allows for more of Traefik's features to be used. Note that deprecation warnings for v1beta1 in kubernetes are not a big deal as this has already been fixed, and will be upgraded in the next release (Kubernetes CRD - Traefik).

You can either follow our getting started guide: (Kubernetes and Let's Encrypt - Traefik) or read some third party guides: (Awesome Traefik · traefik/traefik Wiki · GitHub).

Kubernetes routing is complex, and there are a bajillion different suggestions depending on what you are intending to do. I would suggest starting small, getting HTTP routing working the way you want, then adding TLS once you are familiar with the setup.

Hello @hades,

There are a few examples of running Traefik on Kubernetes combined in a workshop. Here is the link to the workshop:

Please let me know if you need more examples concerning Traefik in the context of Kubernetes.

Thank you, Jakub