# kubectl delete pods busybox-na3tm pod "busybox-na3tm" deleted # kubectl get pods NAME READY STATUS RESTARTS AGE busybox-vlzh3 0/1 ContainerCreating 0 14s # kubectl delete pod busybox-vlzh3 --grace-period=0 # kubectl delete pods --all pod "busybox-131cq" deleted pod "busybox-136x9" deleted pod "busybox-13f8a" deleted pod "busybox-13svg" deleted pod "busybox-1465m" deleted pod "busybox-14uz1" deleted pod "busybox-15raj" deleted pod "busybox-160to" deleted pod "busybox-16191" deleted # kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE default busybox-c9rnx 0/1 RunContainerError 0 23s
高票回答
您需要删除deployment,而deployment会自动删除pod和replica sets
列出所有deployment:
1
kubectl get deployments --all-namespaces
然后删除deployment:
1
kubectl delete -n NAMESPACE deployment DEPLOYMENT
NAMESPACE是其所在的命名空间,而DEPLOYMENT是deployment资源的名称。
在某些情况下,由于job或daemonset也可能正在运行。检查以下内容并运行相应的删除命令。
1 2 3 4 5
kubectl get jobs
kubectl get daemonsets.app --all-namespaces
kubectl get daemonsets.extensions --all-namespaces