Accessing traefik dashboard in your k3s kubernetes cluster without port forwarding.

March 22, 2023
A lot of people use nginx as ingress router in their kubernetes cluster setup, However,I had been using nginx since 2011 and since, ingress-nginx could not provide zero downtime connections as backend pod configurations are changed I decided to give traefik a try. Also ingress-nginx has few security issues. 

A lot of people already know how to access traefik dashboard via port forwarding as follows. 
kubectl -n kube-system port-forward deploy/traefik 9000:9000
However, this might be inconvinient to always start up a port forwarding from your access client. 

Export your CLUSTERIP variable so that we can use it along with service. It is a service that, when queried with a hostname with an embedded IP address, returns that IP address.
You can find your CLUSTERIP in your kubeconfig , 
cat ~/.kube/config | grep server
Expose your traefik port :
kubectl expose deploy/traefik -n kube-system --port=9000 --target-port=9000 --name=traefik-dashboard
create an ingress 
kubectl create ingress traefik-dashboard --rule="dashboard.traefik.$*=traefik-dashboard:9000"
Check for sucess 
curl -si http://dashboard.traefik.$ | head -n 1
Check in browser by clicking http://dashboard.traefik.$ 
replace $CLUSTERIP with your ip.

While at it for better management and security , Let's annotate our ingress. 
kubectl annotate ingress traefik-dashboard