Accessing Kubernetes Dashboard

Accessing Kubernetes Dashboard

(Last Updated On: September 22, 2018)

As of Kubernetes 1.7 the Kubernetes Dashboard has been secured and you might find that it is rather difficult to access it.  In this post, I will show a way to access it if you are having issues.

Kubectl Proxy

First thing to do is setup kubectl to proxy for you:

# kubectl proxy --accept-hosts='^.*$' --address='{your_server_ip}' &

This will let you connect to the dashboard using this url:

http://{your_server_ip}:8001/ui

You will be presented with a login screen:

Kuberentes Dashboard Login

If you click on skip you may not have permissions to do anything by default.

Giving the Kubernetes Dashboard Service Admin Privileges

This opens up your kubernetes to possible attack so definitely do not do this in production.

Create a new file called dashboard-admin.yaml and add the following code:

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: kubernetes-dashboard
  labels:
    k8s-app: kubernetes-dashboard
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: kubernetes-dashboard
  namespace: kube-system

Finally run this command:

# kubectl create -f dashboard-admin.yaml

You can now click on skip and have full privileges to manage your kubernetes cluster.

For more articles on Kubernetes click here.

Need Kubernetes Training?

Checkout these awesome Kubernetes courses from Pluralsight.   Pluralsight gives you outstanding training at a great price.  I use Pluralsight every time I need to learn something new.

Conclusion

I hope you have enjoyed this article, if so please leave a comment below.  For more articles, please signup for the AdminTome Blog below.  Also please feel free to share the article to your friends using the buttons to the left.  Thanks again for reading this post.

 

Leave a Comment

you're currently offline