1. 程式人生 > >Kubernetes刪除namespace後持續terminating狀態

Kubernetes刪除namespace後持續terminating狀態

fin dem ridge 發現 net bec ready operation get

刪除isti和foo的配置文件之後,namespace持續terminating狀態,此時也無法再創建istio-system的namespace

namespace "istio-system" edited
root@ht:~/istio-0.8.0/install/kubernetes# kubectl get ns
NAME                    STATUS        AGE
choerodon-devops-prod   Active        21d
default                 Active        30d
foo                     Terminating   11d
istio
-system Terminating 19d jack-demo Active 29d kube-public Active 30d kube-system Active 30d sock-shop Active 22d

此時再刪除istio-system也無法刪除

root@ht:~/istio-0.8.0/install/kubernetes# kubectl delete ns istio-system
Error from server (Conflict): Operation cannot be fulfilled on namespaces "istio-system": The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.

好像是陷入死循環一樣

此時查看pod,發現本應該已經被刪除的istio系列pod依舊還出現在系統中,並且處於unknowed狀態,失聯了?

root@ht:~/istio-0.8.0/install/kubernetes# kubectl get pod -n istio-system                          
NAME                                        READY     STATUS    RESTARTS   AGE
istio-ingressgateway-6bc7c7c4bc-zwqmn       1/1       Unknown   0
19d istio-statsd-prom-bridge-6dbb7dcc7f-44gzv 1/1 Unknown 0 19d istio-telemetry-54b5bf4847-rn9qj 2/2 Unknown 0 19d

root@ht:~/istio-0.8.0/install/kubernetes# kubectl get pods -n foo
NAME                       READY     STATUS    RESTARTS   AGE
httpbin-68fbcdcfc7-xbf2c   2/2       Unknown   0          11d

推測問題可能出在這

此時用kubetl delete -f 普通刪除沒有響應,故接下來采用強制刪除

root@ht:~/istio-0.8.0/install/kubernetes# kubectl delete pod -n istio-system istio-ingressgateway-6bc7c7c4bc-zwqmn --grace-period=0 --force
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "istio-ingressgateway-6bc7c7c4bc-zwqmn" deleted
root@ht:~/istio-0.8.0/install/kubernetes# kubectl delete pod -n istio-system istio-statsd-prom-bridge-6dbb7dcc7f-44gzv  --grace-period=0 --force                                     
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "istio-statsd-prom-bridge-6dbb7dcc7f-44gzv" deleted
root@ht:~/istio-0.8.0/install/kubernetes# kubectl delete pod -n istio-system istio-telemetry-54b5bf4847-rn9qj  --grace-period=0 --force                                          
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "istio-telemetry-54b5bf4847-rn9qj" deleted
root@ht:~/istio-0.8.0/install/kubernetes# kubectl delete pod -n foo httpbin-68fbcdcfc7-xbf2c --grace-period=0 --force
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "httpbin-68fbcdcfc7-xbf2c" deleted

一開始還是出現terminating的狀態,等待一會後就會發現系統恢復正常

root@ht:/etc/kubernetes# kubectl get ns -o wide
NAME                    STATUS    AGE
choerodon-devops-prod   Active    21d
default                 Active    30d
jack-demo               Active    29d
kube-public             Active    30d
kube-system             Active    30d
sock-shop               Active    22d

Kubernetes刪除namespace後持續terminating狀態