如何“部署"在Kubernetes中没有任何更改,只是为了使Pod循环 [英] How to "deploy" in kubernetes without any changes, just to get pods to cycle

查看:98
本文介绍了如何“部署"在Kubernetes中没有任何更改,只是为了使Pod循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Pod中运行的应用程序在启动时会刷新其数据文件. 每次我要刷新数据时,都需要重新启动容器. (刷新可能需要几分钟,因此我有一个Probe检查是否准备就绪.)

The app that runs in the Pod does some refreshing of its data files on start. I need to restart the container each time I want to refresh the data. (A refresh can take a few minutes, so I have a Probe checking for readiness.)

我将运行预定的工作来执行滚动更新这种部署,它将一次淘汰一个旧的Pod,并在不停机的情况下对其进行替换.

I will run a scheduled job to do a rolling-update kind of deploy, which will take the old Pods out, one at a time and replace them, without downtime.

如果我没有进行任何更改,如何触发部署?

How do I trigger a deploy, if I haven't changed anything??

此外,很明显,我需要能够从计划的作业中执行此操作,因此无需手动编辑..

Also, I need to be able to do this from the scheduled job, obviously, so no manual editing..

还有其他方法吗?

推荐答案

根据

注意:,并且仅当更改了部署的pod模板(即 .spec.template )(例如,更新模板的标签或容器图像.

Note: a Deployment’s rollout is triggered if and only if the Deployment’s pod template (i.e. .spec.template) is changed, e.g. updating labels or container images of the template.

您可以只使用kubectl patch进行更新,即.spec.template内的标签.

You can just use kubectl patch to update i.e. a label inside .spec.template.

这篇关于如何“部署"在Kubernetes中没有任何更改,只是为了使Pod循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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