Minikube Deployment

Deploy a local Minikube cluster with Traefik installed and configured.

Minikube is a popular tool for testing k8s clusters locally. When deploying to Minikube, we use the native Kubernetes port-forward command from kubectl in order to access the services.

1. Install Minikube and start the cluster

Installation instructions for Minikube are here.

Once installed, running minikube start will bring up a local cluster.

2. Install Traefik via Helm

Traefik can be installed via Helm in conjunction with the below Traefik values file -

Traefik Values

The traefik-values.yaml file referenced here is located in:

      - default
      - traefik
      - default
      - traefik

    expose: true
    nodePort: 32090
    nodePort: 32080
    nodePort: 32443
    expose: true
    port: 9042
    nodePort: 32091
    expose: true
    port: 9142
    nodePort: 32092

It can be applied to the cluster using the below commands.

$ helm repo add traefik
$ helm repo update
$ helm install traefik traefik/traefik -n traefik --create-namespace -f traefik.values.yaml
NAME: traefik
LAST DEPLOYED: Thu Nov 12 16:59:40 2020
NAMESPACE: traefik
STATUS: deployed

3. Port forward to the Traefik dashboard

Assuming you have used the above configuration, Traefik will have been installed into a new namespace called traefik. The Traefik dashboard can now be accessed using kubectl port-forward --namespace traefik services/traefik 9000:9000

Minikube offers several options to access a service from the host machine (including via a NodePort on the Minikube host). Additional information can be found in the Minikube documentation. Note that it is sometimes preferable to access services via port-forward as this is closer to the way that services are accessed on a remote cluster.

Note - these settings are not suitable for production.

The steps above will create a NodePort service which will serve the Traefik dashboard to clients outside the k8s cluster. This is not suitable for deployment to cloud platforms (EKS, AKS, GKE etc.) as it will make the dashboard publicly available on any external IPs attached to the node. (Albeit only if access is provided by any security group or firewall on the cluster.) For a cloud-ready configuration, we should ensure that the Traefik dashboard and other internal services are not visible from outside the cluster (except via port-forward as above).

Last modified March 5, 2021: Update size up/down example (#493) (c515698)