2

我无法删除 Kubernetes 仪表板,需要这方面的帮助。我在 AWS 实例上运行 Kubernetes 和 Minikube。我通过运行以下命令安装了 Kubernetes Dashboard:

sudo kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

现在我想删除这个仪表板纯粹是为了学习。我已经执行了以下步骤,但到目前为止没有成功:

1.通过YAML删除

命令

$ sudo kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

输出

serviceaccount "kubernetes-dashboard" deleted
service "kubernetes-dashboard" deleted
secret "kubernetes-dashboard-certs" deleted
secret "kubernetes-dashboard-csrf" deleted
secret "kubernetes-dashboard-key-holder" deleted
configmap "kubernetes-dashboard-settings" deleted
role.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
clusterrole.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
rolebinding.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
clusterrolebinding.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
deployment.apps "kubernetes-dashboard" deleted
service "dashboard-metrics-scraper" deleted
deployment.apps "dashboard-metrics-scraper" deleted

命名空间和其他资源会立即重新创建,仪表板会继续运行:

$ sudo kubectl get namespaces
NAME                   STATUS   AGE
default                Active   8d
kube-node-lease        Active   8d
kube-public            Active   8d
kube-system            Active   8d
kubernetes-dashboard   Active   1s

2. 删除部署

仪表板部署列表

$ sudo kubectl get deployments --namespace=kubernetes-dashboard
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
dashboard-metrics-scraper   1/1     1            1           3m38s
kubernetes-dashboard        1/1     1            1           3m38s

删除仪表板部署

$ sudo kubectl delete deployments dashboard-metrics-scraper --namespace=kubernetes-dashboard
deployment.apps "dashboard-metrics-scraper" deleted
$ sudo kubectl delete deployments kubernetes-dashboard --namespace=kubernetes-dashboard
deployment.apps "kubernetes-dashboard" deleted

重新创建部署

$ sudo kubectl get deployments --namespace=kubernetes-dashboard
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
dashboard-metrics-scraper   0/1     1            0           22s
kubernetes-dashboard        0/1     1            0           1s

我是这项技术的新手。请指导我前进的道路。

4

1 回答 1

0

遵循此处提到的解决方案后,此问题得到解决:

Stackoverflow:如何从 kube-system 中删除 kubernetes 仪表板

于 2019-12-27T06:44:13.413 回答