Using traefik for ingress on a kind cluster

Written by Luke Arntz on December 17, 2021

tags:

Contents

I wasn’t able to find much information online on how to install and use traefik in a kind cluster so decided to write a short post about how I got it working.

Basically, it requires using setting the traefik service to NodePort and the mapping the ports to the control-plane container. To force the traefik pod to run on the control-plane container [node] you have to add a node selector and toleration to the helm values file.

kind

kind version:

kind v0.11.1 go1.16.4 linux/amd64

kind config:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  image: kindest/node:v1.20.7@sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"    
  extraPortMappings:
  - containerPort: 30000
    hostPort: 80
  - containerPort: 30001
    hostPort: 443
- role: worker
  image: kindest/node:v1.20.7@sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9

traefik helm

traefik chart version:

NAME            CHART VERSION   APP VERSION     DESCRIPTION
traefik/traefik 10.7.1          2.5.4           A Traefik based Kubernetes ingress controller

traefik values:

image:
  name: traefik
  pullPolicy: IfNotPresent
service:
  type: NodePort
ports:
  web:
    nodePort: 30000
  websecure:
    nodePort: 30001
nodeSelector:
  ingress-ready: 'true'
tolerations:
  - key: node-role.kubernetes.io/master
    operator: Equal
    effect: NoSchedule

Related Articles

Top