Comments (8)
I think it's the change in #115835 that causes to break the original implementation of the feature.
Although we didn't explain it (preStopHook will not be executed when gracePeriod is 0) in Forced Pod termination and Container Lifecycle Hooks documentation.
I'll fix this and amend the documentation to state that preStopHook is not run when we force delete pod using --grace-period=0
.
/triage accepted
/priority important-soon
from kubernetes.
I think it's the change in #115835 that causes to break the original implementation of the feature.
Although we didn't explain it (preStopHook will not be executed when gracePeriod is 0) in Forced Pod termination and Container Lifecycle Hooks documentation.
I'll fix this and amend the documentation to state that preStopHook is not run when we force delete pod using
--grace-period=0
./triage accepted /priority important-soon
Hi @HirazawaUi and all, I am also concerned about what the expected behavior is when the --force parameter is given.
- Based on the description in document Container Lifecycle Hooks as below, my understanding is that the invocation of PreStop is unconditional:
PreStop
This hook is called immediately before a container is terminated due to an API request or management event such as a liveness/startup probe failure, preemption, resource contention, and others....
Btw, no changes on the statement from 1.25 to 1. 29.
- In addition, in document pod-termination-forced it is said that "...still be given a small grace period before being force killed":
When a force deletion is performed, the API server does not wait for confirmation from the kubelet that the Pod has been terminated on the node it was running on. It removes the Pod in the API immediately so a new Pod can be created with the same name. On the node, Pods that are set to terminate immediately will still be given a small grace period before being force killed.
It is not mentioned that how long the “small grace period” is. Here I am just thinking that the behavior prior to fix implemented in #115835 did not align with this statement while the new behavior does, or at least to some extent.
Looking forward to clarification from the expert group.
Many thanks.
from kubernetes.
/cc
from kubernetes.
/sig node
from kubernetes.
Let me do some research.
/assign
from kubernetes.
In PR #115835, we use gracePeriodOverride
to override gracePeriod
before executing the preStop hook, which brings two destructive changes.
a). When the pod is force delete using --grace-period=0
, we will not execute the preStop hook.
b). The result of the calculateEffectiveGracePeriod
function will always be applied to the preStop hook.
For a, we should fix it, it breaks the original logic,
We always set a value greater than or equal to 1 for gracePeriod
in the calculateEffectiveGracePeriod
function.
ref:
kubernetes/pkg/kubelet/pod_workers.go
Lines 1001 to 1004 in 98bd90f
Although I saw an explanation for this behavior, I'm still curious as to why we need to set gracePeriod
to 1, because I saw in killContainer
that when gracePeriod
is less than minimumGracePeriodInSeconds
, we always set it to the value of minimumGracePeriodInSeconds
ref:
kubernetes/pkg/kubelet/kuberuntime/kuberuntime_container.go
Lines 765 to 768 in 98bd90f
For me, the solution to this issue is to have calculateEffectiveGracePeriod
not set gracePeriod
to a value greater than or equal to 1, or we don't override gracePeriod
when pod.DeletionGracePeriodSeconds=0
For b, I think we did the right thing, but now there seems to be some bugs in the calculateEffectiveGracePeriod
function (when the pod is evicted or force deleted, the value of terminationGracePeriodSeconds
is used as the time to delete the pod). I have seen a PR in fix it, like: #119570
@smarterclayton @bobbypage May I ask if I'm right?
from kubernetes.
/remove-priority important-soon
/priority important-longterm
from kubernetes.
@HirazawaUi: The label(s) priority/
cannot be applied, because the repository doesn't have them.
In response to this:
/remove-priority important-soon
/priority important-longterm
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.
from kubernetes.
Related Issues (20)
- Kubernets service not distributing traffic in equally , seeing imbalance in traffic . HOT 14
- Publish Markdown for OpenAPI field descriptions using an extension HOT 4
- Enhancement: allow to filter what fields to return from the API HOT 3
- [Failing Test] ci-crio-cgroupv1-node-e2e-conformance (Swap Tests) HOT 3
- [Flaking Test] integration-master (goroutine leak detection) HOT 6
- [Flaking Test] ci-node-e2e (Container Lifecycle) HOT 11
- Migrate existing features to versioned feature gate HOT 4
- verification machinery for compatibility version HOT 3
- [Flaking Test] TestLog/stateful_set_logs_with_all_pods HOT 4
- Pod deleted during image pull still starts HOT 10
- ValidatingAdmissionPolicy objects have different runtime type compared to CRDValidationRules HOT 8
- `kube-proxy`'s `--healthz-bind-address` should support IPv4 and IPv6 simultaneously (dual stack) HOT 24
- Bug: securityContext appArmorProfile unconfined not working with containerd HOT 2
- The old pod log file is not deleted from the /var/log/pods/ directory HOT 13
- Job controller reports the count of terminating pods with unnecessary delay HOT 4
- tracking issue; bump pause to 3.10 HOT 4
- kubernetes-sigs / scheduler-plugins go.mod Error HOT 3
- post-kubernetes-push-image-pause failed to publish version 3.10 HOT 15
- Failure cluster [6bc9e9c5...] HOT 1
- Apiserver log "Forcing xxx watcher close due to unresponsiveness" meaning consultation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubernetes.