How do you create a secret from literal values using the CLI?

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 a secret from literal values using the CLI?

Explanation:
Creating a secret from literal values uses the --from-literal flag with the oc create secret generic command. This lets you specify key=value pairs directly on the command line to populate the secret data. For example: oc create secret generic my-secret --from-literal=username=admin --from-literal=password=secret. Each --from-literal adds one data item to the secret with the given key and value, and you can supply multiple literals in the same command to include several items. This is different from --from-file, which reads the secret data from files. The other command options shown either don’t support creating a secret from inline literals or use invalid syntax for this operation.

Creating a secret from literal values uses the --from-literal flag with the oc create secret generic command. This lets you specify key=value pairs directly on the command line to populate the secret data. For example: oc create secret generic my-secret --from-literal=username=admin --from-literal=password=secret. Each --from-literal adds one data item to the secret with the given key and value, and you can supply multiple literals in the same command to include several items. This is different from --from-file, which reads the secret data from files. The other command options shown either don’t support creating a secret from inline literals or use invalid syntax for this operation.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy