Kubectl delete but ignore ones with error

Viewed 9166

I have a list of namespaces and i want to delete them but some of them are giving error and i want to skip that ones and continue other deletions. How can i do that?

kubectl delete services,deployments -n ${namespace} --all  --grace-period=10
1 Answers

You can try using --ignore-not-found=true flag in command

kubectl delete deployments --ignore-not-found=true -n ${namespace} --all  --grace-period=10
Related