kubernetes新手篇-pod删除失败

问题发现

在删除pod时, 有时候会发现pod被删除了, 但是又会自动重建

[root@k8s-master01 ~]# kubectl get pods
NAME                      READY   STATUS    RESTARTS   AGE
myapp3-7996fb4b7c-2hvbz   1/1     Running   0          5m
myapp3-7996fb4b7c-4zp64   1/1     Running   0          5m
myapp3-7996fb4b7c-5qvqn   1/1     Running   0          5m1s
myapp3-7996fb4b7c-8mrmg   1/1     Running   0          4m59s
myapp3-7996fb4b7c-9zdxr   1/1     Running   0          5m1s
myapp3-7996fb4b7c-gbgnq   1/1     Running   0          5m1s
myapp3-7996fb4b7c-jntrm   1/1     Running   0          5m1s
myapp3-7996fb4b7c-m66hg   1/1     Running   0          5m1s
myapp3-7996fb4b7c-mtzlg   1/1     Running   0          5m
myapp3-7996fb4b7c-xdhgc   1/1     Running   0          4m59s

[root@k8s-master01 ~]# kubectl delete pod --all
pod "myapp3-7996fb4b7c-2hvbz" deleted
pod "myapp3-7996fb4b7c-4zp64" deleted
pod "myapp3-7996fb4b7c-5qvqn" deleted
pod "myapp3-7996fb4b7c-8mrmg" deleted
pod "myapp3-7996fb4b7c-9zdxr" deleted
pod "myapp3-7996fb4b7c-gbgnq" deleted
pod "myapp3-7996fb4b7c-jntrm" deleted
pod "myapp3-7996fb4b7c-m66hg" deleted
pod "myapp3-7996fb4b7c-mtzlg" deleted
pod "myapp3-7996fb4b7c-xdhgc" deleted

[root@k8s-master01 ~]# kubectl get pods
NAME                      READY   STATUS    RESTARTS   AGE
myapp3-7996fb4b7c-7bfhs   1/1     Running   0          46s
myapp3-7996fb4b7c-7mcg9   1/1     Running   0          47s
myapp3-7996fb4b7c-7pbl4   1/1     Running   0          47s
myapp3-7996fb4b7c-bk94w   1/1     Running   0          47s
myapp3-7996fb4b7c-cjfnp   1/1     Running   0          48s
myapp3-7996fb4b7c-ftspt   1/1     Running   0          48s
myapp3-7996fb4b7c-gvzc8   1/1     Running   0          46s
myapp3-7996fb4b7c-mdlqm   1/1     Running   0          47s
myapp3-7996fb4b7c-r2kxh   1/1     Running   0          47s
myapp3-7996fb4b7c-r87wn   1/1     Running   0          47s

# 为什么这些pod删除不掉

检查发现,是因为之前设定的副本数量, 删除pod控制器

[root@k8s-master01 ~]# kubectl get deployment myapp3
NAME     READY   UP-TO-DATE   AVAILABLE   AGE
myapp3   10/10   10           10          11h

[root@k8s-master01 ~]# kubectl get pods
No resources found.
# 发现这些pod成功被删除了
上一篇:Generic XXE Detection


下一篇:51单片机静态数码管显示