-
Notifications
You must be signed in to change notification settings - Fork 183
Deleting deployment does not delete pods associated with it #87
Comments
Deleting the Job seems not to delete the Pod neither. May be relate to kubernetes/kubernetes#20497 . But if I try |
This is the current expected behavior. I can't recall where I've discussed this before. I couldn't find another issue so it must have been on Slack. The delete method on each object is the equivelent of deleting the object through the HTTP API. kubectl implements additional logic to cascade deletions to dependent objects. This functionality is something I'd like to see in pykube and even the default behavior, but it is a feature enhancement as opposed to a bug in the current code. |
Thanks for @brosner and it makes sense to me. Does pykube have plan to implement the additional logic to delete all the resources? Or just wait for kubernetes team to provide the full-function APIs for that? I'm not sure if they will do that. It would be great if we can implement the feature by ourselves. |
One workaround is, you can scale a deployment to 0, and then delete the deployment. Scaling it to 0 deletes the associated pods. |
I'm using this
before deleting deployment, and it works well :) |
+1 to this. this seems a bit "odd" so to speak, because most users are familiar with kubectl, and would expect "delete" to delete pods as well |
+1 |
Let's hope this logic will be moved to the server side in the future: kubernetes/kubernetes#12143 (issue is kind of stale) |
We can use deletion policy to tell server to delete dependent resources. |
We have the same issue with kubernetes/kubernetes#32985 .
It may be the bug of
pykube
and we have tested for serval times. If wedelete
the deployment,kubectl get deployment
can not find that deployment, butkubectl get rs
shows that the pods are not deleted.If we use kubectl to delete the deployment, everything works well and the pods will switch to
Terminating
and deleted forever.We have used
pykube
to implement the PaaS service and this is critical for us. Hope anyone can help to confirm and fix this 😃The text was updated successfully, but these errors were encountered: