How to access/expose kubernetes-dashboard service outside of a cluster?

The offical wiki is a little bit confusing so I reordered it here:

If you use the recommended yaml to deploy the dashboard, you should only access your dashboard by https, and you should generate your certs, refer to guide.
Then you can run kubectl proxy --address="0.0.0.0" --accept-hosts="^*$" to visit the dashboard on “http://localhost:8001/ui”. This page needs to use a token to login. To generate it, refer to this page. Also you can add NodePort to your yaml and access it using <nodeip>:<port>.

If you deploy using the http alternative method, you can only access your dashboard by nodeip:port. Remember to add it to yaml first!!
After deployment, you should also generate your token and add header Authorization: Bearer <token> for every request.

I think this can help you and others who want to use kube-dashboard.

Leave a Comment