跳到主要内容

k8s dashboard

Deploy Kubernetes Dashboard

kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml

Verify Dashboard Service is running

kubectl get services -n kube-system

kubectl describe svc/kubernetes-dashboard -n kube-system

kubectl get pods --all-namespaces

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

Kubernetes Dashbaord Authentication using Token

1 create service account

kubectl create serviceaccount k8sadmin -n kube-system

Create a ClusterRoleBinding with Cluster Admin Privileges

kubectl create clusterrolebinding k8sadmin --clusterrole=cluster-admin --serviceaccount=kube-system:k8sadmin

Get the token

kubectl get secret -n kube-system | grep k8sadmin | cut -d " " -f1 | xargs -n 1 | xargs kubectl get secret -o 'jsonpath={.data.token}' -n kube-system | base64 --decode

Delete Kubernetes dashboard Servcie

check from where the service needs to be deleted daemonsets,replicasets,services,deployments,pods,rc --all

kubectl delete replicasets/kubernetes-dashboard -n kube-system kubectl delete svc/kubernetes-dashboard -n kube-system kubectl delete deployments/kubernetes-dashboard -n kube-system kubectl -n kube-system delete $(kubectl -n kube-system get pod -o name | grep dashboard)

kubectl edit svc/kubernetes-dashboard -n kube-system

参考