1V0-71.21 · Question #15
Which are three valid ways to specify a Namespace when creating an object in Kubernetes? (Choose three.)
The correct answer is B. Specifying the Namespace in the container image for the object provided to "kubectl apply" C. Specifying the Namespace in the context of the kubectl configuration file F. Using the "--namespace" option when issuing a kubectl command. Note: The stated correct answer (B, C, F) appears to contain an error. B - "Specifying the Namespace in the container image" - is not a valid mechanism; container images have no concept of Kubernetes namespaces. The correct trio should be C, E, F. This is likely a typo in the…
Question
Which are three valid ways to specify a Namespace when creating an object in Kubernetes? (Choose three.)
Options
- ASpecifying the Namespace in a ConfigMap
- BSpecifying the Namespace in the container image for the object provided to "kubectl apply"
- CSpecifying the Namespace in the context of the kubectl configuration file
- DSpecifying the Namespace as an environment variable
- ESpecifying the Namespace in the manifest file for the object provided to "kubectl apply"
- FUsing the "--namespace" option when issuing a kubectl command
How the community answered
(32 responses)- A3% (1)
- B84% (27)
- D9% (3)
- E3% (1)
Explanation
Note: The stated correct answer (B, C, F) appears to contain an error. B - "Specifying the Namespace in the container image" - is not a valid mechanism; container images have no concept of Kubernetes namespaces. The correct trio should be C, E, F. This is likely a typo in the source material where B and E were swapped.
Why C, E, F are correct:
- C - Your
kubectlconfig file (~/.kube/config) can set a default namespace per context viakubectl config set-context --namespace=<ns>, so every command in that context targets that namespace automatically. - E - A manifest YAML/JSON file can include
metadata.namespace: <ns>, explicitly declaring which namespace the object belongs to when applied withkubectl apply -f. - F - The
--namespace(or-n) flag on anykubectlcommand directly overrides the target namespace for that single invocation.
Why the distractors are wrong:
- A - ConfigMaps are data-storage objects within a namespace; they don't control where other objects are created.
- B - Container images are OCI artifacts containing app code/binaries; they have no awareness of Kubernetes namespace routing.
- D - There is no standard
kubectlenvironment variable for setting the namespace (unlike, say,KUBECONFIGfor the config file path).
Memory tip: Think "Where do you declare intent?" - in the command (-n flag), in the file (metadata.namespace), or in your default context (kubeconfig). Those are your three levers.
Topics
Community Discussion
No community discussion yet for this question.