How do you create configmap cm1 with value PORT=8080?

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

How do you create configmap cm1 with value PORT=8080?

Explanation:
ConfigMaps hold configuration data as key-value pairs, and you can supply those values inline with --from-literal. To create a configmap named cm1 that contains PORT=8080, use: oc create configmap cm1 --from-literal PORT=8080. This directly defines the key PORT with the value 8080 inside the new configmap. The other forms aren’t appropriate here: oc createconfig is not valid syntax, you need a space between create and configmap. Using from-file would populate the configmap from contents of a file rather than a direct literal. Adding --namespace would place the configmap in a specific namespace, which isn’t required unless you’re targeting a particular namespace.

ConfigMaps hold configuration data as key-value pairs, and you can supply those values inline with --from-literal. To create a configmap named cm1 that contains PORT=8080, use: oc create configmap cm1 --from-literal PORT=8080. This directly defines the key PORT with the value 8080 inside the new configmap.

The other forms aren’t appropriate here: oc createconfig is not valid syntax, you need a space between create and configmap. Using from-file would populate the configmap from contents of a file rather than a direct literal. Adding --namespace would place the configmap in a specific namespace, which isn’t required unless you’re targeting a particular namespace.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy