方案一
bash
kubectl delete deployment kubernetes-dashboard --namespace=kube-system
kubectl delete service kubernetes-dashboard --namespace=kube-system
kubectl delete role kubernetes-dashboard-minimal --namespace=kube-system
kubectl delete rolebinding kubernetes-dashboard-minimal --namespace=kube-system
kubectl delete sa kubernetes-dashboard --namespace=kube-system
kubectl delete secret kubernetes-dashboard-certs --namespace=kube-system
kubectl delete secret kubernetes-dashboard-csrf --namespace=kube-system
kubectl delete secret kubernetes-dashboard-key-holder --namespace=kube-system
- 这种就一行一行写清楚,注意把 namespace 换成自己对应的即可
方案二
bash
kubectl -n kubernetes-dashboard delete $(kubectl -n kubernetes-dashboard get deployment,pod,svc,role,rolebinding,sa,secret -o name | grep dashboard)
- 推荐,有点 for 循环查出所有然后再删除的感觉,一行命令解决,同样需要把 namespace 换成自己对应的即可