What is the command to create a configmap cm3 with the literal value DB_HOST=localhost?

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

What is the command to create a configmap cm3 with the literal value DB_HOST=localhost?

Explanation:
ConfigMaps can be created from literal key-value pairs using the --from-literal flag. To create a ConfigMap named cm3 that contains DB_HOST with value localhost, use the resource type and supply the literal: oc create configmap cm3 --from-literal DB_HOST=localhost. Using --from-file would pull data from a file (creating keys from filenames or file contents), which isn’t the explicit DB_HOST=localhost value you need, and omitting the resource type would make the command invalid because OpenShift expects the resource to know what to create.

ConfigMaps can be created from literal key-value pairs using the --from-literal flag. To create a ConfigMap named cm3 that contains DB_HOST with value localhost, use the resource type and supply the literal: oc create configmap cm3 --from-literal DB_HOST=localhost. Using --from-file would pull data from a file (creating keys from filenames or file contents), which isn’t the explicit DB_HOST=localhost value you need, and omitting the resource type would make the command invalid because OpenShift expects the resource to know what to create.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy