如何强制Kubernetes重新拉出图像? [英] How do I force Kubernetes to re-pull an image?
本文介绍了如何强制Kubernetes重新拉出图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在GKE上的Kubernetes中有以下复制控制器:
I have the following replication controller in Kubernetes on GKE:
apiVersion: v1
kind: ReplicationController
metadata:
name: myapp
labels:
app: myapp
spec:
replicas: 2
selector:
app: myapp
deployment: initial
template:
metadata:
labels:
app: myapp
deployment: initial
spec:
containers:
- name: myapp
image: myregistry.com/myapp:5c3dda6b
ports:
- containerPort: 80
imagePullPolicy: Always
imagePullSecrets:
- name: myregistry.com-registry-key
现在,如果我说
kubectl rolling-update myapp --image=us.gcr.io/project-107012/myapp:5c3dda6b
执行滚动更新,但没有重新拉动。为什么?
the rolling update is performed, but no re-pull. Why?
推荐答案
必须在容器数据中对 imagePullPolicy
进行分组在规范数据内部。但是,我提交了一份问题,因为我觉得很奇怪。此外,没有错误消息。
One has to group imagePullPolicy
inside the container data instead of inside the spec data. However, I filed an issue about this because I find it odd. Besides, there is no error message.
因此,此规范片段有效:
So, this spec snippet works:
spec:
containers:
- name: myapp
image: myregistry.com/myapp:5c3dda6b
ports:
- containerPort: 80
imagePullPolicy: Always
imagePullSecrets:
- name: myregistry.com-registry-key
这篇关于如何强制Kubernetes重新拉出图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文