
8

k8s 如何每次拉取最新镜像
source link: https://www.v2ex.com/t/903126
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

CICD 工作流如何保证 kubectl apply -f deploymeny.yaml
每次都是最新的 docker 镜像
#deploymeny.yaml
imagePullPolicy: Always
image: xxx/xxxx/xxx:latest
还是说有必要部署helm
动态渲染deploymeny.yaml
16 条回复 • 2022-12-18 05:52:06 +08:00
![]() |
dingyaguang117 17 小时 37 分钟前 得手动指定 tag 吧,你这个 latest 表意不明确呀?还有如何回滚呢
|
orluna 17 小时 22 分钟前 家用服务,是把 deploymeny.yaml 存在私有 git 上,所以 cicd 不会去修改 git 上的 deploymeny.yaml ,期望是每次拉最新的 images 。实际貌似都是 uncahnged ,只能用 helm 指定 tag 了吗
|
SweetEriri 16 小时 44 分钟前 可以 cicd 构建出镜像后 rollout deploy 滚动更新来拉取最新镜像
|
leeeee9 13 小时 8 分钟前 jenkins 里面加一条删 pod 的不就完事
|
hubqin 11 小时 30 分钟前 每次打镜像用新的 tag 并修改 yaml 里面的镜像为新的 tag
|
chronos 10 小时 47 分钟前 还有不优雅一点的方式,直接用 label 过滤删除对应的 pod ,然后 deployment 会重新将 pod 拉起来,imagePullPolicy: Always 就会拉新的镜像。
kubectl delete pod -l app=labelvalue |
![]() |
zxzflower 8 小时 42 分钟前 如果 yaml 没有其他更新 至单纯更新镜像 直接`set`就好了 没必要`apply -f`
``` kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1 ``` 如果 yaml 有其他更新, 建议还是用`helm` or `kubectl kustomize`吧 或者你不嫌麻烦就脚本更新这个 yaml push 给代码仓库 在下一步拉去 apply 吧. 实际上不建议用 latest 来作为镜像配置. - 你不知道生产上的是哪个版本 - 不利于回滚操作 |
![]() |
moonheart 7 小时 10 分钟前 简单,给 podTemplate 加个 annotation deployedAt=xxx ,每次更新版本都改一次,保证 deployment 会重新滚动
|
![]() |
Shawee 5 小时 49 分钟前 我使用的 argo 和 helm helm 仓库有提交 argo 自动更新
|
![]() |
Nnq 1 小时 19 分钟前 使用详细版本号 或者删除当前所有 deploy 来重新拉去镜像
|
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK