Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Deleting deployment does not delete pods associated with it #87

Open
tobegit3hub opened this issue Oct 24, 2016 · 9 comments
Open

Deleting deployment does not delete pods associated with it #87

tobegit3hub opened this issue Oct 24, 2016 · 9 comments

Comments

@tobegit3hub
Copy link

We have the same issue with kubernetes/kubernetes#32985 .

It may be the bug of pykube and we have tested for serval times. If we delete the deployment, kubectl get deployment can not find that deployment, but kubectl 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 😃

@tobegit3hub
Copy link
Author

tobegit3hub commented Oct 24, 2016

Deleting the Job seems not to delete the Pod neither.

May be relate to kubernetes/kubernetes#20497 . But if I try kubectl delete $job and the pods will be cleaned up.

@brosner
Copy link
Contributor

brosner commented Oct 25, 2016

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.

@tobegit3hub
Copy link
Author

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.

@ecthiender
Copy link

One workaround is, you can scale a deployment to 0, and then delete the deployment. Scaling it to 0 deletes the associated pods.

@Dmitry1987
Copy link

I'm using this

kubectl patch deployment some-name-integration --namespace production -p '{"spec":{"replicas":0}}'

before deleting deployment, and it works well :)

@nfons
Copy link

nfons commented Feb 25, 2017

+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

@ZongqiangZhang
Copy link

+1

@nielsole
Copy link

Let's hope this logic will be moved to the server side in the future: kubernetes/kubernetes#12143 (issue is kind of stale)

@jparklab
Copy link

We can use deletion policy to tell server to delete dependent resources.

#105 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants