标签:sources efault ast min rmi nat run web 孤儿进程
级联删除: 删除StatefulSet时同时删除pod
非级联删除: 删除StatefulSet时不删除pod
[root@k8s-master01 ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-6cdd5dd489-p426b 1/1 Running 0 4h4m
web-0 1/1 Running 0 6h11m
web-1 1/1 Running 0 6h12m
web-2 1/1 Running 0 4h23m
web-3 1/1 Running 0 4h24m
web-4 1/1 Running 0 4h24m
[root@k8s-master01 ~]# kubectl delete sts web
statefulset.apps "web" deleted
[root@k8s-master01 ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-6cdd5dd489-p426b 1/1 Running 0 4h5m
web-0 1/1 Terminating 0 6h11m
web-1 0/1 Terminating 0 6h12m
web-2 0/1 Terminating 0 4h23m
web-3 1/1 Terminating 0 4h24m
web-4 1/1 Terminating 0 4h25m
[root@k8s-master01 ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-6cdd5dd489-p426b 1/1 Running 0 4h7m
web-0 1/1 Running 0 62s
web-1 1/1 Running 0 42s
[root@k8s-master01 ~]# kubectl delete sts web --cascade=false
statefulset.apps "web" deleted
[root@k8s-master01 ~]# kubectl get sts
No resources found in default namespace.
[root@k8s-master01 ~]# kubectl get pod ### 此时的pod变成了孤儿进程,被删除后不会再次重新生产
NAME READY STATUS RESTARTS AGE
nginx-6cdd5dd489-p426b 1/1 Running 0 4h10m
web-0 1/1 Running 0 4m18s
web-1 1/1 Running 0 3m58s
[root@k8s-master01 ~]# kubectl delete pod web-0 web-1
pod "web-0" deleted
pod "web-1" deleted
[root@k8s-master01 ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-6cdd5dd489-p426b 1/1 Running 0 4h13m
[root@k8s-master01 ~]# kubectl get pod -l app=nginx -w
NAME READY STATUS RESTARTS AGE
nginx-6cdd5dd489-p426b 1/1 Running 0 4h13m
web-0 1/1 Running 0 7m1s
web-1 1/1 Running 0 6m41s
web-0 1/1 Terminating 0 7m3s
web-1 1/1 Terminating 0 6m43s
web-0 0/1 Terminating 0 7m4s
web-1 0/1 Terminating 0 6m44s
web-1 0/1 Terminating 0 6m50s
web-1 0/1 Terminating 0 6m50s
web-0 0/1 Terminating 0 7m10s
web-0 0/1 Terminating 0 7m10s
标签:sources efault ast min rmi nat run web 孤儿进程
原文地址:https://www.cnblogs.com/Applogize/p/14398217.html