Which command can be used to create a Kubernetes ConfigMap with specific values using the CLI?

Study for the Kubernetes Cloud Native Associate (KCNA) Certification. Prepare with flashcards and multiple choice questions. Ensure success with detailed explanations. Ready for your exam!

Multiple Choice

Which command can be used to create a Kubernetes ConfigMap with specific values using the CLI?

Explanation:
Creating a ConfigMap from the CLI by supplying literal key-value pairs. The command uses the kubectl create configmap mechanism and attaches data directly on the command line with --from-literal, specifying two keys: COLOUR with value red and KEY with value. This directly builds the ConfigMap named colour-configmap without needing a manifest file, which is exactly what’s being tested—creating a ConfigMap with specific values via the CLI. The other options either create from a file (apply -f configmap.yaml), create a different resource (a Secret), or just retrieve a ConfigMap (get configmap) rather than create one.

Creating a ConfigMap from the CLI by supplying literal key-value pairs. The command uses the kubectl create configmap mechanism and attaches data directly on the command line with --from-literal, specifying two keys: COLOUR with value red and KEY with value. This directly builds the ConfigMap named colour-configmap without needing a manifest file, which is exactly what’s being tested—creating a ConfigMap with specific values via the CLI. The other options either create from a file (apply -f configmap.yaml), create a different resource (a Secret), or just retrieve a ConfigMap (get configmap) rather than create one.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy