Add "force" option to delete pods stuck in Terminating state
The kubectl CLI has a --force delete option which is useful to force-delete pods that are stuck in a Terminating state:
kubectl delete --force --grace-period=0 po/mypod1
There is a grace_period_seconds option, but I wasn't able to find a force option in the API of the python client - perhaps I'm missing something? Thanks
+1 - does not appear to be a force option for deleting pods in the Python API, would seem necessary
+1 - Our k8s tooling would really like to see this feature implemented
--force flag is an order to kubectl to not wait for a confirmation that the pods are deleted. It just sends request to delete and exits without waiting. This library can send the same requests and waiting is not implemented at all. In other words, this lib always acts like kubect with --force flag.
Do you have different experiences with deleting pods using the library?
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close
@fejta-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity. Reopen the issue with
/reopen. Mark the issue as fresh with/remove-lifecycle rotten.Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Not sure if things were different in 2019, but just for clarification since this still ranks pretty high on Google:
--grace-period=0 alone in kubectl (without --force) is equivalent to --grace-period=1 since kubectl has some "backwards compability" to avoid actually instant terminating in case --force is missing.
https://github.com/kubernetes/kubectl/blob/826006cdb947f80a679ff1eb3cb53f183a6a9bf2/pkg/cmd/delete/delete.go#L189-L196
All --force in kubectl does here is not waiting and actually setting the grace period to 0.
So converting kubectl <-> Python API means:
--grace-period=0 = grace_period_seconds=1
--grace-period=0 --force = grace_period_seconds=0
+1 I'd like to be able to force delete pods using the python library.
We have pods stuck in terminating that I'd like to delete.
@MalteMagnussen Setting grace_period_seconds=0 in delete(_namespaced)_pod should do the same thing.