卸载kubernetes-dashboard
kubectl get secret,sa,role,rolebinding,services,deployments --namespace=kube-system | grep dashboard sudo kubectl delete deployment kubernetes-dashboard --namespace=kube-system sudo kubectl delete service kubernetes-dashboard --namespace=kube-system sudo kubectl delete role kubernetes-dashboard-minimal --namespace=kube-system sudo kubectl delete rolebinding kubernetes-dashboard-minimal --namespace=kube-system sudo kubectl delete sa kubernetes-dashboard --namespace=kube-system sudo kubectl delete secret kubernetes-dashboard-certs --namespace=kube-system sudo kubectl delete secret kubernetes-dashboard-csrf --namespace=kube-system sudo kubectl delete secret kubernetes-dashboard-key-holder --namespace=kube-system
安装kubernetes-dashboard
[root@k8s-master ~]# wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml [root@k8s-master ~]# vim kubernetes-dashboard.yaml 修改内容: 109 spec: 110 containers: 111 - name: kubernetes-dashboard 112 image: registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetes-dashboard-amd64:v1.10.1 # 修改此行 ...... 157 spec: 158 type: NodePort # 增加此行 159 ports: 160 - port: 443 161 targetPort: 8443 162 nodePort: 30001 # 增加此行 163 selector: 164 k8s-app: kubernetes-dashboard [root@k8s-master ~]# kubectl apply -f kubernetes-dashboard.yaml [root@k8s-master ~]# kubectl create clusterrolebinding test:kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard [root@k8s-master ~]# kubectl describe secrets -n kube-system $(kubectl -n kube-system get secret | awk '/kubernetes-dashboard/{print $1}')