-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advice on setting environment variables for a process in a container #40394
Comments
This issue is currently awaiting triage. SIG Docs takes a lead on issue triage for this website, but any Kubernetes member can accept issues by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind support |
Hey @xlouba, you can find about setting env variables and use them with the bash commands here - |
You can also try like this -
export hello="cat demo_greeting.md"
$hello
# setting env variable
env:
- name: DEMO_GREETING
value: "cat demo_greeting.md"
# Invoking it
command: [$DEMO_GREETING] |
Thanks! However, it seems that definitions like this in yaml can only execute commands, rather than assigning the results of command execution to variable DEMO_GREETING. Is there any way to assign the results of command execution to environment variables? |
Hi @xlouba, then u can use it as export DEMO_GREETING=$(cat demo_greeting.md) |
Ok, I see. I will take this way. Thank you! |
kubernetes can define environment variable for container with name and value.
env: - name: DEMO_GREETING value: "Hello from the environment" - name: DEMO_FAREWELL value: "Such a sweet sorrow"
How can I define the variable by executing command like this:
env: - name: DEMO_GREETING value: "$(cat demo_greeting.md)"
The text was updated successfully, but these errors were encountered: