kubernetes头盔何时触发豆荚重新创建? [英] When does kubernetes helm trigger a pod recreate?
问题描述
头盔文档建议通过重新创建广告连播设置可变元数据值.
The helm documentation suggests to recreate a pod by setting variable metadata values.
例如:
kind: Deployment
spec:
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
[...]
但是,当未重新创建广告连播时,会出现一个情况:
But there a situations, when a pod is not recreated:
- 状态为
CrashLoopBackOff
的吊舱是错误的 - 仅部署元数据已更改
- A pod is erroneous in state
CrashLoopBackOff
- Only Deployment Metadata has changed
我想知道什么事件确实触发了广告连播的重新创建:
I would like to know what events do trigger a pod recreate:
- 为什么状态为
CrashLoopBackOff
的Pod无法重新启动? - 为什么不将规范的所有部分都视为重新创建广告连播?
- Why is the pod in state
CrashLoopBackOff
not restarted? - Why are not all parts of the spec considered to recreate the pod?
修改
CrashLookBackOff
是一个应用程序问题.
但是,如果提供了新映像(包含错误修正),则应重新启动Pod,而无需显式杀死它.
The CrashLookBackOff
is an application problem.
But if a new image (containing the bugfix) is provided, the pod should be restarted without the need to kill it explicitly.
是否有理由不重新启动CrashLookBackOff
pod?
Is there a cause not to restart the CrashLookBackOff
pod?
推荐答案
Deployment
中的模板是PodTemplate
.每次更改PodTemplate时,都会创建一个新的ReplicaSet,并使用PodTemplate根据副本数创建新的Pod.
The template in a Deployment
is a PodTemplate
. Every time the PodTemplate is changed, a new ReplicaSet is created, and it creates new Pods according to the number of replicas using the PodTemplate.
kind: Deployment
spec:
template:
# any change here will lead to new Pods
每次从模板创建新的Pod时,它都会与以前的Pod相同.
Everytime a new Pod is created from a template, it will be identical as the previous pods.
A CrashLoopBackOff
是Pod级问题,例如该应用程序可能有问题.
A CrashLoopBackOff
is a Pod-level problem, e.g. it may be a problem with the application.
但是,如果提供了新的映像(包含错误修正),则应重新启动Pod,而无需显式杀死它.
But if a new image (containing the bugfix) is provided, the pod should be restarted without the need to kill it explicitly.
如果提供了新图像,则该图像应具有其自己的唯一名称.这意味着无论何时更改图像,都必须更改图像名称.图像名称的更改是PodTemplate中的更改,因此它将始终创建新的Pod-并删除而不重用旧的Pod.
If a new image is provided, it should have its own unique name. That means that whenever you change the image, you have to change the image name. A change of the image name is a change in the PodTemplate, so it will always create new Pods - and delete but not reuse old Pods.
这篇关于kubernetes头盔何时触发豆荚重新创建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!