我的Kubernetes项目yaml如下:
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: kubebiz.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
我执行了滚动更新,但不重新拉。为什么?
有2种方式可以做到镜像每次都重新拉取:
:latest
imagePullPolicy: Always
方法一:
image: kubebiz.com/myapp:latest
方法二,设置拉取策略为
Always
:spec: containers: - name: myapp image: kubebiz.com/myapp:5c3dda6b imagePullPolicy: Always
参考来自:imagePullPolicy拉取策略
你的答案