- The Dashboard UI is not deployed by default. To deploy it, run the following command:
Copy
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
This way of accessing Dashboard is only recommended for development environments in a single node setup.
Edit kubernetes-dashboard service.
$ kubectl -n kube-system edit service kubernetes-dashboard
You should see yaml representation of the service. Change type: ClusterIP to type: NodePort and save file. If it's already changed go to next step.
# Please edit the object below. Lines beginning with a '#' will be ignored,# and an empty file will abort the edit. If an error occurs while saving this file will be# reopened with the relevant failures.#apiVersion: v1
...
name: kubernetes-dashboardnamespace: kube-systemresourceVersion: "343478"selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard-headuid: 8e48f478-993d-11e7-87e0-901b0e532516spec:
clusterIP: 10.100.124.90externalTrafficPolicy: Clusterports:
- port: 443protocol: TCPtargetPort: 8443selector:
k8s-app: kubernetes-dashboardsessionAffinity: Nonetype: ClusterIPstatus:
loadBalancer: {}Verify that the K8S dashboard is exposed on NodePort.
~]# kubectl get service -n kube-system kubernetes-dashboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes-dashboard NodePort 10.109.238.150 <none> 443:31038/TCP 146m
You can access the K8S dashboard from your browser at
https://<node-ip>:<nodePort>
apiVersion: v1kind: ServiceAccountmetadata:
name: admin-usernamespace: kube-systemapiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata:
name: admin-userroleRef:
apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: cluster-adminsubjects:
- kind: ServiceAccountname: admin-usernamespace: kube-systemkubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')