kuberneter 上面装了 helm 想卸载还并不是那么简单,

参考 stackoverflow 回复

kubectl get -n kube-system secrets,sa,clusterrolebinding -o name|grep tiller|xargs kubectl -n kube-system delete
kubectl get all -n kube-system -l app=helm -o name|xargs kubectl delete -n kube-system

先查看 pod

[root@k8snode1 ~]# kubectl get pods --all-namespaces
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
kube-system   calico-kube-controllers-7fc57b95d4-wzgt7   1/1     Running   0          20h
kube-system   calico-node-768jt                          1/1     Running   0          20h
kube-system   calico-node-gh7xn                          1/1     Running   1          19h
kube-system   calico-node-mr7tq                          1/1     Running   1          19h
kube-system   coredns-6967fb4995-5tqt4                   1/1     Running   0          20h
kube-system   coredns-6967fb4995-8hcrx                   1/1     Running   0          20h
kube-system   etcd-k8snode1                              1/1     Running   1          20h
kube-system   kube-apiserver-k8snode1                    1/1     Running   1          20h
kube-system   kube-controller-manager-k8snode1           1/1     Running   1          20h
kube-system   kube-proxy-dq2h5                           1/1     Running   1          19h
kube-system   kube-proxy-hhhlm                           1/1     Running   2          19h
kube-system   kube-proxy-xpkjj                           1/1     Running   1          20h
kube-system   kube-scheduler-k8snode1                    1/1     Running   1          20h
kube-system   tiller-deploy-5cdbdd477f-bj54f             1/1     Running   0          17m

执行第一条命令

[root@k8snode1 ~]# kubectl get -n kube-system secrets,sa,clusterrolebinding -o name|grep tiller|xargs kubectl -n kube-system delete
secret "tiller-token-z9bml" deleted
serviceaccount "tiller" deleted
warning: deleting cluster-scoped resources, not scoped to the provided namespace
clusterrolebinding.rbac.authorization.k8s.io "tiller" deleted
[root@k8snode1 ~]# 

再执行第二条命令

[root@k8snode1 ~]# kubectl get all -n kube-system -l app=helm -o name|xargs kubectl delete -n kube-system 
pod "tiller-deploy-5cdbdd477f-bj54f" deleted
service "tiller-deploy" deleted
deployment.apps "tiller-deploy" deleted
replicaset.apps "tiller-deploy-5cdbdd477f" deleted
[root@k8snode1 ~]# 

再次查看 pod, tiller 已经被卸载。
在这里插入图片描述

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐