Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the process of Pod exiting?

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "Pod exit process is how", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Pod exit process is how" it!

The user deletes the Pod.

2.1. Pod enters the Terminating state.

2.2. At the same time, K8s removes Pod from the corresponding service.

2.3. At the same time, for containers with PreStop Hook, kubelet invokes the PreStop Hook of each container, and if the running time of PreStop Hook exceeds grace period (defined in the .spec.terminationGracePerforming seconds field of Pod), kubelet sends SIGTERM and waits for another 2 seconds.

2.4. At the same time, kubelet sends SIGTERM for containers that do not have PreStop Hook.

After the grace period exceeds, kubelet sends SIGKILL to kill the containers that have not yet exited.

Therefore, there is also a "maximum tolerable time" in the Pod termination process for K8s, namely grace period (defined in the .spec.terminationGracePerforming seconds field of Pod), which defaults to 30 seconds, and we can also override the configuration in Pod by explicitly specifying an elegant exit time when we execute kubectl delete with the-grace-period parameter. When the grace period exceeds, K8s can only choose SIGKILL to force Pod to be killed.

-

K8s version 1.11.2

TerminationGracePeriodSeconds: 300

Lifecycle:

PreStop:

Exec:

Command: ["/ bin/bash", "- c", "sleep 300"]

Set the same effect: 30s

Set different to terminationGracePeriodSeconds > preStop sleep.

Subject to preStop sleep

= those providing services to the outside world

TerminationGracePeriodSeconds = 360

PreStop sleep=300

= of the task task type

TerminationGracePeriodSeconds = 3

PreStop sleep=2

Thank you for your reading, the above is the content of "what is the process of Pod exit". After the study of this article, I believe you have a deeper understanding of how the process of Pod exit is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report