Which command adds an environment variable to deployment myapp from a secret named 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

Which command adds an environment variable to deployment myapp from a secret named mysecret?

Explanation:
The action being tested is how to inject environment variables into a deployment from a secret. Using the command with the --from flag and specifying the secret by name tells OpenShift to take all key/value pairs stored in that secret and expose them as environment variables in the deployment’s containers. In this form, secret=mysecret designates the secret to source from, so each key in the secret becomes an environment variable with the same name and its corresponding value. This approach is direct: you don’t set individual env vars manually, and you don’t overwrite existing ones unless you choose to with an extra flag. The other forms either refer to a different secret or use syntax that doesn’t correctly identify the secret source, which is why they aren’t appropriate in this case.

The action being tested is how to inject environment variables into a deployment from a secret. Using the command with the --from flag and specifying the secret by name tells OpenShift to take all key/value pairs stored in that secret and expose them as environment variables in the deployment’s containers. In this form, secret=mysecret designates the secret to source from, so each key in the secret becomes an environment variable with the same name and its corresponding value.

This approach is direct: you don’t set individual env vars manually, and you don’t overwrite existing ones unless you choose to with an extra flag. The other forms either refer to a different secret or use syntax that doesn’t correctly identify the secret source, which is why they aren’t appropriate in this case.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy