1.安装

  1. # kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.3.0/aio/deploy/recommended.yaml
  2. wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.3.0/aio/deploy/recommended.yaml
  3. kubectl apply -f recommended.yaml

image.png

2.问题解决

1.问题

image.png

  1. root@k8s-node1:/home/cooling# kubectl apply -f recommended.yaml
  2. The connection to the server localhost:8080 was refused - did you specify the right host or port?

2.解决方案

3.删除kubernetes-dashboard

  1. kubectl get secret,sa,role,rolebinding,services,deployments --namespace=kube-system | grep dashboard
  2. kubectl delete deployment kubernetes-dashboard --namespace=kube-system
  3. kubectl delete service kubernetes-dashboard --namespace=kube-system
  4. kubectl delete role kubernetes-dashboard-minimal --namespace=kube-system
  5. kubectl delete rolebinding kubernetes-dashboard-minimal --namespace=kube-system
  6. kubectl delete sa kubernetes-dashboard --namespace=kube-system
  7. kubectl delete secret kubernetes-dashboard-certs --namespace=kube-system
  8. kubectl delete secret kubernetes-dashboard-key-holder --namespace=kube-system