Setting K8S environment variables in gitlab ci yml

I can set environment variables to be passed to the kubernetes app with K8S_SECRET using the UI but I would like to use the yml file to set common (yet dynamic) public environment variables without users needing to have access to change the secret settings. I want that section to be reserved for actual secrets like passwords and keys. I tried adding a variable to the “variables” section but learned that this is just passed to the runner. I have 4 environments I’m pushing out to, and I need to set an environment variable to be different since .NET Core uses it.

These are linux containers.


I think this feature does not exist yet, and after some research, I’d say you want to add your thoughts to this feature request:


1 Like

I realized that putting K8S_SECRET_ before my variables in the yaml file worked the same way as doing so in the UI. This format is still odd and I’d rather have another section for it with clean names, but it works.