visit
Eventually, you'll want to tear some of them down, to free up CPU, disk, and RAM for your next wild experiment.
This happens to us all the time in our research clusters, and we've picked up a few tricks:
kubectl delete -f mad-science.yml
If you've been dutifully recording your resource definitions in a YAML file, and just kept
kubectl apply
-ing it, you're in luck! The kubectl delete
command also understands the -f
flag, and will remove every resource defined.→ kubectl apply -f shield.yml
# ... time passes ...
→ kubectl delete -f shield.yml
# clean as a whistle!
kubectl apply -f experiment-42.d/
kubectl delete -f experiment-42.d/
kubectl delete ns quantum-crypto-coin
All namespaces resources get deleted when you delete the owning namespace, which is a pretty handy way of tearing down things like pods, services, namespaces, etc. If you're not clear what is and is not namespaced, you can run the
api-resources
command to find out:kubectl api-resources --namespaced
kubectl api-resources --namespaced=false
Also seen .