Menu

Accessing Kubernetes Dashboard

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.

Tags:
%d bloggers like this: