这篇文章主要介绍“kubernates怎么删除pod”,在日常操作中,相信很多人在kubernates怎么删除pod问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”kubernates怎么删除pod”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
删除pod,使用如下命令,发现没有生效,执行之后还是会重新创建该pod
[root@localhost data]# kubectl delete pods example-demo-94f66596d-k2rgw --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 "example-demo-94f66596d-k2rgw" force deleted
在stackoverflow上,看到一个(https://stackoverflow.com/questions/40686151/kubernetes-pod-gets-recreated-when-deleted),有效
查看所有的deployment [root@localhost data]# kubectl get deployments --all-namespaces NAMESPACE NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE default example-demo 1 1 1 1 2h default example-demo2 1 1 1 1 2h default example-demo3 1 1 1 1 1h default example-demo4 2 2 2 2 52m kube-system coredns 2 2 2 2 4h kube-system heapster 1 1 1 1 4h kube-system kubernetes-dashboard 1 1 1 1 4h kube-system monitoring-grafana 1 1 1 1 4h kube-system monitoring-influxdb 1 1 1 1 4h 删除deployment,使用命令"kubectl delete -n NAMESPACE deployment DEPLOYMENT",如下 [root@localhost data]# kubectl delete -n default deployment example-demo [root@localhost data]# kubectl delete -n default deployment example-demo2 [root@localhost data]# kubectl delete -n default deployment example-demo3 [root@localhost data]# kubectl delete -n default deployment example-demo4 之后查看pods信息,如下,这样才真正删除了pod [root@localhost data]# kubectl get pods No resources found.
到此,关于“kubernates怎么删除pod”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。