Which two commands create a ConfigMap from a literal key/value and then propagate it to a DeploymentConfig as an environment variable?

Prepare for the Red Hat OpenShift Developer II DO288 Exam with our quizzes. Study with flashcards and multiple choice questions, each with hints and explanations. Get ready for your certification!

Multiple Choice

Which two commands create a ConfigMap from a literal key/value and then propagate it to a DeploymentConfig as an environment variable?

Explanation:
Creating a ConfigMap from a literal and then using that ConfigMap to populate a DeploymentConfig’s environment hinges on doing the two steps in the right order. First, you create the ConfigMap with a literal key/value, which stores that data in Kubernetes. Once the ConfigMap exists, you can wire its contents into the DeploymentConfig by using an env-setting command that pulls from the ConfigMap, pulling all its keys as environment variables with the same names. This is why the sequence is to run the create-configmap command with --from-literal, then run the set-env command on the DeploymentConfig with --from cm/<configmap-name>. Trying to set environment from the ConfigMap before it exists would fail, and using an alternate creation command or order wouldn’t provide the proper, existing source for the environment variables.

Creating a ConfigMap from a literal and then using that ConfigMap to populate a DeploymentConfig’s environment hinges on doing the two steps in the right order. First, you create the ConfigMap with a literal key/value, which stores that data in Kubernetes. Once the ConfigMap exists, you can wire its contents into the DeploymentConfig by using an env-setting command that pulls from the ConfigMap, pulling all its keys as environment variables with the same names. This is why the sequence is to run the create-configmap command with --from-literal, then run the set-env command on the DeploymentConfig with --from cm/. Trying to set environment from the ConfigMap before it exists would fail, and using an alternate creation command or order wouldn’t provide the proper, existing source for the environment variables.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy