Kubernetes:--image-pull-policy总是不起作用 [英] Kubernetes: --image-pull-policy always does not work
问题描述
我有一个使用图像的Kubernetes部署:test:latest
(不是真实的图像名称,但这是最新的标签).
此图像位于docker hub上.我刚刚将test:latest
的新版本推送到dockerhub.我原本希望在Kubernetes中重新部署我的Pod,但是什么也没发生.
I have a Kubernetes deployment which uses image: test:latest
(not real image name but it's the latest tag).
This image is on docker hub. I have just pushed a new version of test:latest
to dockerhub. I was expecting a new deployment of my pod in Kubernetes but nothing happends.
我已经创建了这样的部署:
I've created my deployment like this:
kubectl run sample-app --image=`test:latest` --namespace=sample-app --image-pull-policy Always
为什么在推送新映像后没有触发新部署?
Why isn't there a new deployment triggered after the push of a new image?
推荐答案
Kubernetes 不正在监视图像的新版本.映像拉取策略指定如何获取映像以运行容器. Always
表示它将在每次启动容器时尝试拉出新版本.要查看更新,您需要删除Pod(而不是Deployment)-新创建的Pod将运行新映像.
Kubernetes is not watching for a new version of the image. The image pull policy specifies how to acquire the image to run the container. Always
means it will try to pull a new version each time it's starting a container. To see the update you'd need to delete the Pod (not the Deployment) - the newly created Pod will run the new image.
没有直接方法让Kubernetes自动使用新映像更新正在运行的容器.这将是连续交付系统的一部分(也许将kubectl set image
与新的sha256sum或图像标签一起使用-而不是latest
).
There is no direct way to have Kubernetes automatically update running containers with new images. This would be part of a continuous delivery system (perhaps using kubectl set image
with the new sha256sum or an image tag - but not latest
).
这篇关于Kubernetes:--image-pull-policy总是不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!