Kubernetes clean slate

5/24/2017

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?

-- scalapeno
kubernetes

3 Answers

5/25/2017

First delete the deployments, otherwise the pods will be recreated:

kubectl delete deployments --all --force --grace-period=0
-- scalapeno
Source: StackOverflow

5/24/2017

You need to delete the deployments, not the pods. Otherwise the ReplicaSet from the Deployment will just recreate the PODs (self healing capability).

-- Oswin Noetzelmann
Source: StackOverflow

5/24/2017

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)

-- syntagma
Source: StackOverflow