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.yaml file referenced here is located in:
--- providers: kubernetesCRD: namespaces: - default - traefik kubernetesIngress: namespaces: - default - traefik ports: traefik: expose: true nodePort: 32090 web: nodePort: 32080 websecure: nodePort: 32443 cassandra: expose: true port: 9042 nodePort: 32091 cassandrasecure: expose: true port: 9142 nodePort: 32092
It can be applied to the cluster using the below commands.
$ helm repo add traefik https://helm.traefik.io/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 REVISION: 1 TEST SUITE: None
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).
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.