Study. uk . com
  1. Home
  2. All questions
  3. Question 124

CKA study material · question 124 of 1000

Which command fixes the namespace for all later kubectl commands in the current context?

  1. kubectl namespace <name>
  2. export KUBE_NAMESPACE=<name>
  3. kubectl config set-context --current --namespace <name>
  4. kubectl config use-context <name>
Show the answer

Answer: C. kubectl config set-context --current --namespace <name>

set-context --current --namespace stores the namespace in the context, unlike a one-off --namespace flag.

Source: Namespaces (Kubernetes) — Setting the namespace preference

Challenge yourself on this topic → Study as cards