简体   繁体   English

如何强行删除 kubernetes 集群中的 daemonset 或 pod

[英]How to forcefully delete a daemonset or a pod in kubernetes cluster

I have setup a kubernetes cluster which is working fine.我已经设置了一个运行良好的kubernetes集群。 I created deployment with type as daemonset which then created few pods and it worked fine.我创建了类型为daemonset deployment ,然后创建了几个 pod,它运行良好。 I made few changes so I deleted the daemonset using:我做了一些更改,所以我使用以下命令删除了daemonset

kubectl delete daemonset <name> --namespace=clustech

While few pods were getting deleted, few of the machine went offline and thus the pods running on them went on to say unknown status.虽然很少有 pod 被删除,但很少有机器脱机,因此在它们上面运行的 pod 继续说unknown状态。 I need to remove those pods or completely remove that previous daemonset but unable to do.我需要删除这些 pod 或完全删除以前的daemonset但无法做到。 I am using below commands to delete pods:我正在使用以下命令删除豆荚:

kubectl delete pod PODNAME --grace-period=0 --force

But this shows below error:但这显示以下错误:

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.
Error from server (NotFound): pods "deployment-6sj54" not found

How can I delete the pods.?我怎样才能删除豆荚。?

Re-run the second command with namespace parameter will do your job.使用namespace参数重新运行第二个命令将完成您的工作。

--grace-period=0 --force is the right command to delete such pods. --grace-period=0 --force是删除此类 pod 的正确命令。

您可以使用以下命令删除 daemonset.apps:

kubectl delete --all daemonset.apps -n <namespace>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM