Immediate deletion does not wait for confirmation that the running resource has been terminated. ...

Kubernetes上删除pod时,简单的delete有时不起作用,那么就会用到强制删除,
但是强制删除有时又会发生一些比较奇怪的现象。

强制删除pod

kubectl delete pod -n istio-system xx --grace-period=0 --force
xx 是pod name

奇怪的现象

强制删除有时会有警告出现,并且删完之后,立刻又冒出来一个

[root@iZwz983wql3f1yerh738xeZ jaeger]# kubectl get pods -n istio-system
NAME                                 READY     STATUS    RESTARTS   AGE
jaeger-deployment-7f98f999cd-4vwjc   1/1       Running   0          13m
[root@iZwz983wql3f1yerh738xeZ jaeger]# kubectl delete pod -n istio-system jaeger-deployment-7f98f999cd-4vwjc --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 "jaeger-deployment-7f98f999cd-4vwjc" deleted
[root@iZwz983wql3f1yerh738xeZ jaeger]# kubectl get pods -n istio-system
NAME                                 READY     STATUS    RESTARTS   AGE
jaeger-deployment-7f98f999cd-2pmmb   0/1       Running   0          2s

可以看到删除jaeger-deployment-7f98f999cd-4vwjc之后,
又冒出来一个jaeger-deployment-7f98f999cd-2pmmb
删除这个冒出来的,又会出现另一个。。。

谷歌了一下,找到了一个方法

[root@iZwz983wql3f1yerh738xeZ jaeger]# kubectl get deployments -n istio-system
NAME                DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
jaeger-deployment   1         1         1            1           1d
[root@iZwz983wql3f1yerh738xeZ jaeger]# kubectl delete deployment -n istio-system jaeger-deployment --force --grace-period=0
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.
deployment.extensions "jaeger-deployment" deleted
[root@iZwz983wql3f1yerh738xeZ jaeger]# kubectl get deployments -n istio-system
No resources found.
[root@iZwz983wql3f1yerh738xeZ jaeger]# kubectl get pods -n istio-system
No resources found.

Solution

所以解决方法是:(注意替换namespacename哦)

  1. kubectl get deployments -n istio-system
  2. kubectl delete deployment -n istio-system jaeger-deployment --force --grace-period=0
  3. kubectl get deployments -n istio-system
  4. kubectl get pods -n istio-system

参考
https://github.com/ypapax/kubernetes/issues/3

    原文作者:Yellowtail
    原文地址: https://www.jianshu.com/p/ef0d47f17419
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞