Question 26
Domain 1: Application Design and BuildWhich kubectl command creates a Secret named `mysecret` with the key-value pair `password=mypass`?
Correct answer: A
Explanation
`kubectl create secret generic` creates a Secret object, and `--from-literal=password=mypass` adds a literal key-value pair to it. The command names the Secret `mysecret`, so it produces a Secret with the key `password` set to `mypass`.
Why each option is right or wrong
A. kubectl create secret generic mysecret --from-literal=password=mypass
`kubectl create secret generic` is the subcommand used to create a Secret of type `Opaque`, and the object name is taken from the positional argument immediately after `generic`—here, `mysecret`. The `--from-literal=password=mypass` flag adds exactly one data entry with key `password` and value `mypass`; no file path or manifest is needed, so this command directly produces the requested Secret.
B. kubectl create configmap mysecret --from-literal=password=mypass
C. kubectl create secret generic mysecret --from-file=password=mypass
D. kubectl create secret docker-registry mysecret --from-literal=password=mypass