Kubernetes add system variable to Dockers entrypoint

1/17/2020

here's the problem. I've a Pod running in my cluster with angular. I want to use a System Variable in Dockers entrypoint. It would be very helpful for my use case.

According to my understanding the entrypoint is executed as soon as you pull the image in Kubernetes.

So my idea is to use a system variable in Dockers Entrypoint which will be initialized later during deployment. Kubernetes set the system variable and AFTER this, the entrypoint should be execute.

Do you have experience or do you see a mistake here?

Thanks for your help

-- goku736
angular
deployment
docker
environment-variables
kubernetes

1 Answer

1/17/2020

You can reference environment variables in command and args.

From https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/

env:
- name: MESSAGE
  value: "hello world"
command: ["/bin/echo"]
args: ["$(MESSAGE)"]
-- Shashank V
Source: StackOverflow