Gitlab + GKE + AutoDevops set environment variables

10/1/2018

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

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

-- itaied
continuous-integration
gitlab
google-kubernetes-engine

1 Answer

10/4/2018

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

-- Yehuda
Source: StackOverflow