Kubernetes

Traefik Helm install and configuration

Traefik is a great ingress controller for Kubernetes clusters allowing you to have an L7 ingress routing engine to route ingress traffic to your Kubernetes-hosted services. In this tutorial, we will look at Traefik helm install and configuration to see how you get up and running with Traefik using MetalLB as the load balancer and using helm for installation.

Prerequisites for Traefik Helm install

You can use Node Port to work with Traefik. However, NodePort is cumbersome to manage and does not scale very well, even in a lab environment. There is no harm in using it, as long as you want to take on the management of ports and connectivity ingress via these ports.

However, take a look at my post covering the topic of Kubernetes Install MetalLB Loadbalancer and see how you can easily get MetalLB running and create a simple configuration to hand out IP addresses for Kubernetes services. Using that post, you will have MetalLB configured as the load balancer for your Kubernetes cluster so that you can have IP addresses mapped for your Kubernetes services.

Aside from having MetalLB running, I have a standard 3-node Kubernetes cluster managed by Rancher with helm installed on my Linux management workstation.

Traefik Helm install and configuration

For the most part, I will be following the steps for deploying Traefik using Helm found here: Traefik Installation Documentation – Traefik.

The steps have you add the Helm repo, update the repo, and then install the helm chart. I will first add an extra step to customize the chart before we deploy it using helm. Note the commands below:

helm repo add traefik https://helm.traefik.io/traefik
helm repo update
helm show values traefik/traefik > /tmp/traefik-chart.yaml

We are adding the extra step to save the chart values into a temporary file so that we can edit a few of the values before deploying.

Traefik helm repo install and update
Traefik helm repo install and update

Let’s highlight a few of the configuration values you may want to customize. Below, I am enabling the dashboard by setting the expose value for Port 9000 to true.

Expose the Traefik dashboard
Expose the Traefik dashboard

Below, the type LoadBalancer is defined by default. I am leaving this as is since I am using MetalLB.

Verifying the configuration is of type loadbalancer
Verifying the configuration is of type loadbalancer

Next, we will set the persistence to true since we are using a persistent volume storage class by means of Longhorn. Check out my post on how to Install Longhorn Rancher for Kubernetes Block Storage for more information on using Longhorn in your Kubernetes cluster.

Enabling persistence for your Traefik deployment
Enabling persistence for your Traefik deployment

Now, we can actually deploy the Traefik chart by means of the values file using the syntax:

helm install traefik traefik/traefik --values /tmp/traefik-chart.yaml -n traefik --create-namespace 

You can list out the helm deployment status using:

helm list -n traefik
Installing the helm chart from the values file and checking the helm deployment
Installing the helm chart from the values file and checking the helm deployment

Now, if you check the Traefik namespace, with a get all, you will see that we have correctly grabbed a LoadBalancer IP address and the proper ports are exposed.

Checking the traefik namespace for the status of the resources
Checking the traefik namespace for the status of the resources

Traefik Helm install and configuration FAQs

Let’s consider the following FAQs around Traefik helm install and configuration:

  • What is Helm? You can think of helm like a package manager such as snap, apt, yum, or others for Kubernetes. Helm allows pulling specific installation YAML files called charts to install software inside your Kubernetes clusters.
  • What is Traefik? Traefik is a very popular and powerful ingress controller in Kubernetes. Ingress controllers in Kubernetes are layer 7 routing engine API endpoints allowing services to be accessed correctly inside the Kubernetes cluster without additional complexity brought about by other networking constructs. With Traefik, you can route traffic based on hostnames, etc.
  • What is MetalLB? MetalLB is a load balancer solution specifically for self-hosted Kubernetes clusters, since most hyperscalers already have a load balancer solution. The MetalLB solution allows an easy way to automatically assign IP addresses to Kubernetes cluster services so that an external IP address can be used to access the internal-only ClusterIP endpoints.
  • What is a load balancer? A load balancer provides load balancing and network configuration for Kubernetes services. In the case of MetalLB, it allows having an automatic network IP address configuration engine to expose services to internal ClusterIP resources.

Wrapping up

Traefik is a great tool for exposing services in your Kubernetes clusters. It works well with other Kubernetes tools such as MetalLB to provide a seamless and automated service configuration framework allowing IT admins to expose services in the K8s cluster easily. Hopefully, this Traefik helm install and configuration tutorial helps to unravel some of the questions you may have about getting this setup.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, Brandon has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.