我用
创建了一个CronJob资源kubectl create -f cronjob.yaml
现在我的comp太乱了,cronjob试图每次创建一个节点
15 minutes
batch-job-every-fifteen-minutes-1528876800-h8dsj 0/1 Pending 0 39m
batch-job-every-fifteen-minutes-1528877700-d8g9d 0/1 Pending 0 24m
batch-job-every-fifteen-minutes-1528878600-kbdmb 0/1 Pending 0 9m
如何执行相反的操作? 如何删除资源?
答案 0 :(得分:1)
您可以使用以下命令删除它:
kubectl delete -f cronjob.yaml
也可以直接按名称删除它:
kubectl delete cronjob batch-job-every-fifteen-minutes
我不确定使用此命令是否也会删除生成的Pod和Jobs。你可以删除它们:
kubectl delete job batch-job-every-fifteen-minutes-1528876800
kubectl delete job batch-job-every-fifteen-minutes-1528877700
kubectl delete job batch-job-every-fifteen-minutes-1528878600
kubectl delete pod batch-job-every-fifteen-minutes-1528876800-h8dsj
kubectl delete pod batch-job-every-fifteen-minutes-1528877700-d8g9d
kubectl delete pod batch-job-every-fifteen-minutes-1528878600-kbdmb
此解决方案假定您使用的是default
命名空间。如果不这样做,则必须将--namespace $NAMESPACE
参数添加到kubectl
。