I want to delete a pod permanently so I can create the deployment.yaml and derveice.yaml again from fresh, so I tried:
kubctl delete pod <pod>
and the pod is still there, also tried:
kubectl delete pods <pod> --grace-period=0
and didnt work.
the only thing that worked is when I set the deployment replicas: 0
and then apply it, but the when i try to create new deployment i get:
Error from server: error when creating "myService/deployment.yaml": deployments.extensions "myService" already exists
Pods are created by Deployment, so when you delete a Pod then Deployment automatically create it base on replicas
value, you have to delete Deployment and then create it again,
You can use:
kubectl create -f deployment.yml
kubectl delete -f deployment.yml
Deleting Deployment
specific to the pods will terminate the pods automatically
kubectl get deployments
kubectl delete deployment deployment_name_to_delete --namespace=default
(e.g., kubectl delete deployment ngnix --namespace=default)
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