码迷,mamicode.com
首页 > 其他好文 > 详细

StatefulSet删除

时间:2021-02-15 12:41:00      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:sources   efault   ast   min   rmi   nat   run   web   孤儿进程   

1.分类

级联删除: 删除StatefulSet时同时删除pod
非级联删除: 删除StatefulSet时不删除pod

2.级联删除

[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

3.非级联删除

[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


StatefulSet删除

标签:sources   efault   ast   min   rmi   nat   run   web   孤儿进程   

原文地址:https://www.cnblogs.com/Applogize/p/14398217.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!