I'm following a kubernetes tutorial. I got halfway through but now I want to start over.
I tried kubectl delete pods --all --force
but when I do kubectl get pods
it still shows my deployments, and the age is reset. How do I get back to a pristine state to restart the tutorial?
First delete the deployments, otherwise the pods will be recreated:
kubectl delete deployments --all --force --grace-period=0
You need to delete the deployments, not the pods. Otherwise the ReplicaSet from the Deployment will just recreate the PODs (self healing capability).
Firt, delete the deployments, so that the ReplicaSet
won't recreate pods:
kubectl delete deployments --all --force --grace-period=0
Then, use the --grace-period
flag:
kubectl delete pods <pod> --grace-period=0 --force
From the documentation:
--grace-period int Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. (default -1)