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.
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
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With