Kubernetes 是在节点之间移动 pods 还是重新创建 pods 的副本集?

Does Kubernetes move pods between nodes or is the Replica Set that recreates the pods?

我想知道 Kubernetes 是否可以自动将 pods 移动到另一个节点(如果该节点资源处于关键状态),或者如果这种情况仅发生在由副本集管理的 pods 上?

特别是:

  1. bare pod(不是由副本集或类似的管理)被逐出时会发生什么?它是移动到另一个节点还是刚刚被删除?
  2. 如果它被“移动”到一个新的节点,它是真的移动了还是被重新创建了?例如,它的 age 会改变吗?
  3. 是否只有 pods 由 Deployments 和 Replica Sets 管理 在新节点上 moved/recreated 而 bare pods 只是在资源不足的情况下删除?

一个孤立的 pod 将在被驱逐时被 kubelet/eviction_manager 删除,没有娱乐。

没有removed,只有recreated

deploy/replicaset 将保留副本数,因此将创建一个新的 pod,kube-scheduler 将其调度到适合的节点。

  1. What happens when a bare pod (not managed by Replica Sets or similar) is evicted? Is it moved to another node or it is just removed?

广告连播是 designed as a relatively ephemeral, disposable entity; when it is evicted, it's deleted by a Kubelet agent running on the node. There is no recreating / moving to the other node, it's just removed (for bare pods). The controllers (like Deployment, StatefulSet, DaemonSet) are responsible for placing the replacement pods

  1. In case it is "moved" to a new node, is it really moved or it is recreated? For example, does its age change?

我在上一个问题的回答中提到,在Kubernetes架构中pods是designed as relatively ephemeral, disposable entities,所以没有“移动”。它在相同或新节点上重新创建为“新”pod。 age 参数已更改,它是从头开始计数,因为它是一个新的 pod。

  1. Is it true that only pods managed by Deployments and Replica Sets are moved/recreated on a new node while bare pods are simply removed in case of resource shortage?

不仅 pods 由 Deployment/ReplicaSets 管理,一些 other controllers (e.g StatefulSet). When a pod is missing (it's got evicted by resource shortage or there is a rolling update), the controllers are making requests to the Kubernetes Scheduler 也推出了新的 pods。没有重新创建第一个问题中回答的裸 pods。

如果您想了解有关此过程的更多信息,请查看