Deleting job with delete_namespaced_job() does not delete pods
See original GitHub issueWhen deleting a job with BatchV1Api.delete_namespaced_job
, the job resource is deleted, but the pod(s) remain.
From this documentation, my assumption was to try Ophaned
, Background
, or Foreground
as the propagation_policy
, but none of them did anything to the pod after the job was deleted.
Upon further inspection of the pod metadata, both finalizers
and owner_references
are set with None
.
Here’s the gist of the script I used to reproduce this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
deleteNamespacedJob() do not delete pod · Issue #777 - GitHub
I use deleteNamespacedJob() to delete the job, but it throw a error issuse86.I catch the error but find the pod is still exist....
Read more >How can I delete all pods via delete job - Stack Overflow
For Cronjob. You can use the successfulJobsHistoryLimit to manage the pod count, if you will set it to 0, POD will get removed...
Read more >Creating, Updating and Deleting Resources with the Java ...
Here, we're just using the deleteNamespacedJob method to remove the job using default options for this specific kind of resource. If required, ...
Read more >Deleting jobs using REST API does not delete the associated ...
I creating and deleting jobs by making REST API calls from inside a pod. But while deleting the job the associated pod is...
Read more >Kubernetes Tasks - Prefect Docs
After the job is successfully completed, all resources by default are deleted: job and the corresponding pods. If job is in the failed...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@alanbchristie
See #423
The following code works for me:
body = client.V1DeleteOptions(propagation_policy='Background')
resp = api.delete_namespaced_deployment(name=item.metadata.name, body=body, namespace=self.namespace)
I disagree - I just tested the parameter like this
and it works as expected. Now I don’t know if it will be deprecated but saying that it has no effect is incorrect.