Add an environment variable to a deployment myapp from a secret mysecret?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

Add an environment variable to a deployment myapp from a secret mysecret?

Explanation:
Adding environment variables from a secret to a deployment uses the command that imports every key from the secret as environment variables in the deployment’s pods. For a deployment named myapp and a secret named mysecret, the appropriate command is oc set env deployment/myapp --from secret/mysecret. This approach applies the secret’s keys as env vars to all containers in the deployment; you’d only add --container if you needed to target a specific container within the pod. The other options either reference the wrong secret, introduce unnecessary overwriting, or unnecessarily constrain the operation to a single container.

Adding environment variables from a secret to a deployment uses the command that imports every key from the secret as environment variables in the deployment’s pods. For a deployment named myapp and a secret named mysecret, the appropriate command is oc set env deployment/myapp --from secret/mysecret. This approach applies the secret’s keys as env vars to all containers in the deployment; you’d only add --container if you needed to target a specific container within the pod. The other options either reference the wrong secret, introduce unnecessary overwriting, or unnecessarily constrain the operation to a single container.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy