如何使用滚动更新重新拉动容器映像? [英] How to use rolling update to re-pull container image?

查看:69
本文介绍了如何使用滚动更新重新拉动容器映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由容器组成的kubernetes RC/pod,其图像如下:foobar/my-image:[branch]-latest其中"branch"是git分支("master"等).

I have a kubernetes RC/pod consisting of containers with images like: foobar/my-image:[branch]-latest where "branch" is the git branch ("master", etc).

使用滚动更新强制RC重新拉动图像以获取最新版本的最佳方法是什么?蛮力方法是简单地删除RC并重新创建它,但这会导致服务停机.

What's the best way to use rolling-update to force the RC to re-pull the images to get the latest version? The brute force method is to simply delete the RC and re-create it, but that causes downtime for the service.

仅当您指定确切的图片标签而不是最新"标签时,才可以进行滚动更新吗?

Is rolling update only possible if you specify an exact image tag, rather than something like "latest"?

推荐答案

您应该能够使用

You should be able to use a rolling update specifying the same image name that you are currently using:

kubectl rolling-update <replication-controller-name> --image=foobar/myimage:[branch]-latest

这将(在幕后)创建一个新的复制控制器,该复制控制器是具有新"映像的现有复制控制器的副本,然后逐步调整每个复制控制器的大小,直到旧的复制控制器的零容器和新的复制控制器一个具有所需数量的Pod,最后删除旧的Pod,然后重命名新的Pod以使用旧名称.

This will (behind the scenes) create a new replication controller that is a copy of your existing replication controller with the "new" image, and then stepwise resize each of the replication controllers until the old one has zero pods and the new one has the desired number of pods, finally deleting the old one and renaming the new one to use the old name.

这篇关于如何使用滚动更新重新拉动容器映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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