How do you create configmap cm2 for the file /tmp/values.txt?

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 cm2 for the file /tmp/values.txt?

Explanation:
Creating a ConfigMap from a file is done with the --from-file option. When you point this option at a real file, the ConfigMap gets a data entry whose key is the file name (values.txt) and whose value is the contents of that file. So for the file at /tmp/values.txt, you end up with a ConfigMap named cm2 that contains a key values.txt with the file’s contents. This is the expected, straightforward way to bring file data into a ConfigMap. Using a literal with --from-literal would place a literal string into the ConfigMap rather than the file’s contents, and referencing a non-existent path would fail because the file can’t be read.

Creating a ConfigMap from a file is done with the --from-file option. When you point this option at a real file, the ConfigMap gets a data entry whose key is the file name (values.txt) and whose value is the contents of that file. So for the file at /tmp/values.txt, you end up with a ConfigMap named cm2 that contains a key values.txt with the file’s contents. This is the expected, straightforward way to bring file data into a ConfigMap. Using a literal with --from-literal would place a literal string into the ConfigMap rather than the file’s contents, and referencing a non-existent path would fail because the file can’t be read.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy