# 查找 Kubernetes 中原有证书的 Secret $ kubectl get secret kubernetes-dashboard-certs -n kubernetes-dashboard NAME TYPE DATA AGE kubernetes-dashboard-certs Opaque 0 65d
$ kubectl get pod -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE dashboard-metrics-scraper-7b8b58dc8b-nw7l7 1/1 Running 3 64d kubernetes-dashboard-5f5f847d57-88ssx 1/1 Running 3 64d
删除现有的 Kubernetes-Dashboard 的 Pod
1 2 3 4 5
$ kubectl delete po kubernetes-dashboard-5f5f847d57-88ssx -n kubernetes-dashboard pod "kubernetes-dashboard-5f5f847d57-88ssx" deleted
$ kubectl delete po dashboard-metrics-scraper-7b8b58dc8b-nw7l7 -n kubernetes-dashboard pod "dashboard-metrics-scraper-7b8b58dc8b-nw7l7" deleted
如果 Pod 比较多的时候,你还可以使用以下这条命令批量删除。
1
$ kubectl get pod -n kubernetes-dashboard | grep -v NAME | awk '{print "kubectl delete po " $1 " -n kubernetes-dashboard"}' | sh
删除完成后,新的 Kubernetes-Dashboard Pod 会自动启动起来。
1 2 3 4
$ kubectl get pod -n kubernetes-dashboard NAME READY STATUS RESTARTS AGE dashboard-metrics-scraper-7b8b58dc8b-w9zzh 1/1 Running 0 35s kubernetes-dashboard-5f5f847d57-4q76w 1/1 Running 0 53s