Gitlab + GKE + AutoDevops设置环境变量 [英] Gitlab + GKE + AutoDevops set environment variables

查看:252
本文介绍了Gitlab + GKE + AutoDevops设置环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在GKE上使用gitlab auto devops成功部署了一个应用。

如何为我的应用容器设置环境变量?

I have successfully deployed an app using gitlab auto devops on GKE.
How can I set environment variables for my app containers?

变量例如PORT,DB_URL,第三方服务等...

Variables like PORT, DB_URL, 3rd party services etc ...

推荐答案

我正在从GitLab部署到GKE,但没有AutoDevops,但是在在部署yaml中定义了k8s个环境变量。如果要从GitLab设置它们,并且希望它们在部署之间(生产/开发等)不同,那么我建议使用Helm并将--set传递给helm install / upgrade命令。
另一种选择是在脚本编写中自行编辑yaml,但是如果您使用的是Helm,则不需要

I am deploying to GKE from GitLab but without AutoDevops, but in k8s the env vars are defined in the deployment yaml. If you want to set them from GitLab and you want them to be different between deployments (production / dev etc.) then I recommend using Helm and passing --set to the helm install/upgrade command. The other alternative is to edit the yaml by your self in scripting, but this not needed if you are using Helm

这篇关于Gitlab + GKE + AutoDevops设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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