nerdexam
Broadcom-VMware

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…

Explain Container and Kubernetes Concepts

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)
  • A
    3% (1)
  • B
    84% (27)
  • D
    9% (3)
  • E
    3% (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 kubectl config file (~/.kube/config) can set a default namespace per context via kubectl 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 with kubectl apply -f.
  • F - The --namespace (or -n) flag on any kubectl command 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 kubectl environment variable for setting the namespace (unlike, say, KUBECONFIG for 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

#Kubernetes Namespaces#kubectl Configuration#kubeconfig#Namespace Specification

Community Discussion

No community discussion yet for this question.

Full 1V0-71.21 Practice