gpt4 book ai didi

kubernetes - K8 Pod生命周期:是否需要清理?

转载 作者:行者123 更新时间:2023-12-02 12:07:33 26 4
gpt4 key购买 nike

Kubernetes Docs说以下内容:

In general, Pods do not disappear until someone destroys them. This might be a human or a controller. The only exception to this rule is that Pods with a phase of Succeeded or Failed for more than some duration (determined by the master) will expire and be automatically destroyed.



此持续时间的默认值是多少?如何设置?我的广告连播也从不会进入成功或失败阶段,而是分别进入已完成或错误阶段。这是可以预期的吗?文档过时了吗?

我使用 kubectl get pods --show-all检查pod阶段,有关它们的信息似乎仍然存在。是否需要进行其他清理?在不使用 kubectl get pods的情况下运行 --show-all不会显示任何已删除的pod。

我正在使用 kubectl apply -f k8/dummy-pod.yaml和以下yaml文件创建pod:
apiVersion: v1
kind: Pod
metadata:
name: dummy.3
labels:
vara: a
role: idk
spec:
hostNetwork: true
restartPolicy: Never
containers:
- image: gcr.io/gv-test-196801/dummy:v2
name: dummy-1

最佳答案

我认为该文档已过时。
使用TTL was abandoned的容器垃圾回收,有利于终止的容器的阈值数量。 Kube Controller 管理器上的--terminated-pod-gc-threshold(docs here)。

当前删除DaemonSet, Deployment, ReplicaSet or StatefulSet会默认使其孤立。
您可以通过enabling cascading deletes解决此问题

此行为将在1.10中更改

Prior to apps/v1 the default garbage collection policy for Pods in a DaemonSet, Deployment, ReplicaSet, or StatefulSet, was to orphan the Pods. That is, if you deleted one of these kinds, the Pods that they owned would not be deleted automatically unless cascading deletion was explicitly specified



kubernetes blog

关于kubernetes - K8 Pod生命周期:是否需要清理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49142859/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com