Is there a variant of kubectl delete all --all
command or some other command to delete all resources except the kubernetes service?
I don't think there's a built-in command for it, which means you'll have to script your way out of it, something like this (add an if
for the namespace you want to spare):
$ for ns in $(kubectl get ns --output=jsonpath={.items[*].metadata.name}); do kubectl delete ns/$ns; done;
Note: deleting a namespace deletes all its resources.