Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to access Gitlab env variables either in node.js or react

I have two different projects checked in Gitlab, frontend and backend. For both the projects i have a Dockerfile each. I have set the env variables in gitlab ci/cd . I am running docker container in kubernetes, but i am not able to access the gitlab env variables either in my react or node.js (express) application.

I was thinking that those env variable would be available to me when i do process.env.variable_name, but i am not able to access them.

What’s the best way to access Gitlab env variables in kubernetes (deployment.yaml) env variables ?

UPDATE

I have found that we can specify env variables in kubernetes, deployment.yaml file (under env section). How can i pass gitlab env variables to deployment.yaml?

like image 962
Fakeer Avatar asked Sep 03 '25 06:09

Fakeer


1 Answers

Docker containers require that you set environment variables when you run them:

https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file

--env , -e      Set environment variables
like image 146
sparrow Avatar answered Sep 04 '25 19:09

sparrow