Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubernetes cleanup of pods,service,deployment etc

To setup the kubernetes, I started with creating namespace, deployment, service. To clean the resources, do I need to follow any order like remove the service first then pods and then deployment and finally namespace? how to clean the resources in a proper way? Because I deleted pods and service, but I could see the pods,services running again. Its deploying the resources again, so this question came up here for experts answers.

like image 947
intechops6 Avatar asked Jul 12 '19 21:07

intechops6


2 Answers

Just in case you are running them in default namespace and there are many of them ,and you don't want to spend time on deleting them one by one:

kubectl delete deployments --all
kubectl delete services --all
kubectl delete pods --all
kubectl delete daemonset --all
like image 64
Ijaz Ahmad Avatar answered Nov 01 '22 09:11

Ijaz Ahmad


I deleted the resources in the below order and it worked for me.

To get all the resources.

kubectl get pods,services,deployments,jobs,daemonset

Delete the resources like below:

kubectl delete deployments <deployment>
kubectl delete services <services>
kubectl delete pods <pods>
kubectl delete daemonset <daemonset>
like image 23
intechops6 Avatar answered Nov 01 '22 08:11

intechops6