Kubernetes:--image-pull-policy 总是不起作用 [英] Kubernetes: --image-pull-policy always does not work

查看:35
本文介绍了Kubernetes:--image-pull-policy 总是不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用图像的 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(而不是部署) - 新创建的 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 使用新镜像自动更新正在运行的容器.这将是持续交付系统的一部分(可能使用带有新的 sha256sum 或图像标签的 kubectl set image - 但不是 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆