如何强制 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屋!
查看全文