v1.0
Managed Kubernetes

How to deploy Traefik Ingress Controller on Kubernetes using Helm

In this tutorial, you will learn how to deploy a Traefik ingress controller on your Kubernetes cluster. You will learn more about Traefik, its benefits and how to set it up and configure it on Kubernetes using Helm.

We will be using a Platform9 Managed Kubernetes cluster for this tutorial. However, you can use this tutorial to deploy Traefik on any Kubernetes cluster of your choice.

What is Traefik

Traefik Kubernetes Ingress is a modern, full-featured ingress controller for Kubernetes with powerful capabilities out of the box. Traefik installs as one or more pods that represent the Traefik controller, ingress proxies, and mesh proxies in your Kubernetes cluster.

Prerequisites

  • A Kubernetes cluster.
  • A Kubectl installation with your Kubernetes cluster from the step above configured as the primary cluster.
  • The helm 3 package manager client installed on your local machine. Follow Helm CLI to install the helm client on your machine

Step 1 - Install via CLI or PMK App Catalog

CLI

Once your Kubernetes cluster is up and running, you need to add the helm repository for Traefik to the cluster.

add helm repository
Copy
output
Copy

Once you have added the helm repository, perform a generic repository update for your helm repositories to fetch the latest upstream updates for the newly-added traefik chart repository.

helm repo update
Copy
output
Copy

Install the Traefik chart, ensuring you are scoped to the desired namespace.

helm install
Copy
output
Copy

Once Traefik is installed, validate that the resources were deployed correctly, e.g. the Traefik service was created, the Traefik pod is running, etc.

kubectl get svc
Copy
output
Copy
kubectl get pods
Copy
output
Copy

PMK App Catalog

The PMK App Catalog can simplify installations and allow you to modify the application using the UI instead of working from the command line. We will walk through an installation using the App Catalog below.

Start out by navigating to the Apps section. Select + Add New Repository.

Then we will name the repository, in our example we name it Traefik. The URL is going to be the Helm Repository that hosts the charts we need. For Traefik we will use https://helm.traefik.io/traefik. Save and move on to the next step.

Now the available applications will show up under the App Catalog section. We are going to deploy Traefik. Select Deploy on the Traefik tile. This will take us to the configuration of our application.

In the Deploy Application page we can name our deployment, select the cluster, namespace, version, and modify the values associated with the deployment. We will name the deployment traefik and select the cluster we want to use, then select the default namespace. The version will be set to the latest version as of this post: 10.9.1.

If you want to access the Dashboard for Traefik using an IP address and port 9000 then we will need to modify the values file. The Dashboard will deploy with "traefik" as the default entrypoint, which means we need to update the expose option from false to true. Once modified we will select Deploy.

traefik values
Copy

If you want to modify the Dashboard IngressRoute to use Web, which is exposed by default and will allow use of port 80, then don't modify the deployment. We will update the IngressRoute after the Deployment has finished and add a Host so that traffic is routed based on "demo.pf9.io".

Step 2 - Expose Traefik Dashboard

By default, the helm chart and PMK App Catalog deploy an IngressRoute for the Traefik dashboard.

default yaml
Copy

By default the entryPoint for traefik is not exposed, which means we'll either need to expose the endpoint - like we did above - or change the endpoint to web and add a Host to the match field. This assumes we want to access the Dashboard via port 80 using a domain instead of an IP address.

kubectl edit ingressroute
Copy
updated yaml
Copy

In our example demo.pf9.io is pointing at the LoadBalancer associated with the ingress controller. Since this is all local we are updating /etc/hosts - however you could also update local DNS to achieve the same results. If our LoadBalancer was a Public IP then we could update DNS for our domain using an A record or CNAME depending on your provider. Realistically you would want to set this up with certificates and TLS, however that is beyond the scope of this getting started guide.

kubectl get svc
Copy
demo.pf9.io
Copy

If you are having trouble reaching the dashboard on the exposed Ingress route, you can alternatively port-forward the connection via kubectl .

Bash
Copy
Output
Copy

Conclusion

You have now successfully installed Traefik ingress controller for your Kubernetes cluster.

Interested in more Content?

  Last updated