Environment variables inside Kubernetes application deployment?

Hello,

I’m trying Gitlab DevOps right now, I have a very very basic Hello World NodeJS app inside my Gitlab repository. I configured autoDevops with the kubernetes deployment.

So now, Gitlab automatically deploy my app to “staging” and “production” environments, that’s great.

I can use .gitlab-ci.yml to set to customize the deployment phase depending of environments, I’m good with it.

But, how can I set the environment variables that will be available inside my running NodeJS application depending on this deployment ?

For example, I would like my NodeJS app to say “Hello World Staging” or “Hello World Production” depending on the running environment.

Thanks for help.

good question, any answer on that?

Hi, did you find an answer?

This was a tricky one. The only place this is mentioned in the doc is here:

production-postgresql

You can pass env variables as secrets to the container if the CI variable with the prefix K8S_SECRET_* is set.