k8s中prestop钩子执行命令后的行为?-灵析社区

九久九

优雅停机,关于k8s可配置的prestop钩子。例如我采用exec执行命令行的形式,命令行执行正常返回0之后,k8s依然会等到宽限期到达才会删除pod而非是exec命令执行成功后立刻删除pod 在k8s的官方文档中没有找到这个问题的解答

阅读量:13

点赞量:0

问AI
"https://kubernetes.io/docs/concepts/containers/container-life..." (https://link.segmentfault.com/?enc=CbKmyJJCJfCKRakTQcNZOg%3D%3D.FlQHEQNJyVgVA6AyfPZYbm7H0C%2F%2FR2noNserhL8V%2FvrRGweDzx5iuvY2Y8jSruxuUZBSqIk3Qgk7kawKqHNgT9evusajbKevrbY%2BQDZbT5g%3D) «PreStopThis 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. A call to the PreStop hook fails if the container is already in a terminated or completed state and the hook must complete before the TERM signal to stop the container can be sent. The Pod's termination grace period countdown begins before the PreStop hook is executed, so regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period. No parameters are passed to the handler.»