简体   繁体   English

确保在没有序号 pod id 的情况下正常关闭 pod

[英]Ensuring graceful shutdown of a pod without ordinal pod ids

  1. When a pod is in a restart loop is it eligible for being removed during scaling down before it restarts successfully?当 Pod 处于重启循环中时,它是否有资格在成功重启之前在缩减期间被移除? (without stateful sets) (没有状态集)

  2. Also what happens if a pod container exits with a non-zero exit code when scaling that pod down?此外,如果 pod 容器在缩小该 pod 时以非零退出代码退出,会发生什么情况? Will it be restarted and shutdown again or just removed?它会重新启动并再次关闭还是只是删除? (with or without stateful sets) (有或没有状态集)

  3. Can I ensure that a pod is always gracefully shutdown without using stateful sets (because I want lifetime-unique UIDs instead of distinct reusable ordinal ids)?我能否确保在不使用有状态集的情况下始终正常关闭 pod(因为我想要生命周期唯一的 UID,而不是不同的可重用序号 id)?

Can I ensure that a pod is always gracefully shutdown without using stateful sets (because I want lifetime-unique UIDs instead of distinct reusable ordinal ids)?我能否确保在不使用有状态集的情况下始终正常关闭 pod(因为我想要生命周期唯一的 UID,而不是不同的可重用序号 id)? Pods which are part of Job or Cronjob resources will run until all of the containers in the pod complete.作为 Job 或 Cronjob 资源一部分的 Pod 将一直运行,直到 Pod 中的所有容器都完成。 However, the Linkerd proxy container runs continuously until it receives a TERM signal.但是,Linkerd 代理容器会持续运行,直到收到 TERM 信号。 Since Kubernetes does not give the proxy a means to know when the Cronjob has completed, by default, Job and Cronjob pods which have been meshed will continue to run even once the main container has completed.由于 Kubernetes 没有为代理提供知道 Cronjob 何时完成的方法,默认情况下,即使主容器完成,已网格化的 Job 和 Cronjob pod 仍将继续运行。 it means we can stop graecfull shutdown这意味着我们可以停止 graecfull 关机

You can achieve this in three steps:您可以通过三个步骤实现此目的:

Add a label to all pods except the one you want to delete.将 label 添加到除您要删除的 pod 之外的所有 pod。 Because the labels of the pods still satisfy the selector of the Replica Set, so no new pods will be created.因为 Pod 的标签仍然满足 Replica Set 的选择器,所以不会创建新的 Pod。

Update the Replica Set: adding the new label to the selector and decreasing the replicas of the Replica Set atomically.更新副本集:将新的 label 添加到选择器中,并原子地减少副本集的副本。 The pod you want to delete won't be selected by the Replica Set because it doesn't have the new label.您要删除的 pod 不会被 Replica Set 选中,因为它没有新的 label。

Delete the selected pod.删除选定的 pod。

Fore more information refer to these documents .有关详细信息, 请参阅这些文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM