Bird
Raised Fist0
Kubernetesdevops~10 mins

Default namespaces overview in Kubernetes - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to list all namespaces in Kubernetes.

Kubernetes
kubectl get [1]
Drag options to blanks, or click blank then click option'
Anamespaces
Bpods
Cservices
Dnodes
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pods' instead of 'namespaces' will list pods, not namespaces.
Using 'services' or 'nodes' will list other resources, not namespaces.
2fill in blank
medium

Complete the command to switch to the default namespace in Kubernetes.

Kubernetes
kubectl config set-context --current --namespace=[1]
Drag options to blanks, or click blank then click option'
Adefault
Bkube-system
Cproduction
Ddev
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'kube-system' switches to the system namespace, not default.
Using custom names like 'production' or 'dev' will fail if those namespaces don't exist.
3fill in blank
hard

Fix the error in the command to describe the default namespace.

Kubernetes
kubectl describe [1] default
Drag options to blanks, or click blank then click option'
Apod
Bnode
Cservice
Dnamespace
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pod' will try to describe a pod named 'default', which likely does not exist.
Using 'service' or 'node' will describe other resource types, not namespaces.
4fill in blank
hard

Fill both blanks to create a pod in the default namespace using kubectl.

Kubernetes
kubectl run nginx --image=nginx --restart=Never -n [1] --port=[2]
Drag options to blanks, or click blank then click option'
Adefault
B80
C443
Dkube-system
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'kube-system' will create the pod in the system namespace, not default.
Using port 443 is for HTTPS, but nginx defaults to 80.
5fill in blank
hard

Fill all three blanks to list pods in the default namespace with wide output.

Kubernetes
kubectl get [1] -n [2] -o [3]
Drag options to blanks, or click blank then click option'
Apods
Bdefault
Cwide
Dservices
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'services' instead of 'pods' will list services, not pods.
Using other output formats like 'json' or 'yaml' will show different formats, not wide.

Practice

(1/5)
1. What is the purpose of namespaces in Kubernetes?
easy
A. To replace pods in the cluster
B. To increase the CPU speed of nodes
C. To organize resources into separate groups within a cluster
D. To store container images

Solution

  1. Step 1: Understand what namespaces do

    Namespaces help group and isolate resources in a Kubernetes cluster.
  2. Step 2: Identify the correct purpose

    They do not affect CPU speed, store images, or replace pods.
  3. Final Answer:

    To organize resources into separate groups within a cluster -> Option C
  4. Quick Check:

    Namespaces organize resources [OK]
Hint: Namespaces group resources logically in Kubernetes [OK]
Common Mistakes:
  • Thinking namespaces speed up nodes
  • Confusing namespaces with image storage
  • Believing namespaces replace pods
2. Which of the following is a default namespace in Kubernetes?
easy
A. user-space
B. production
C. development
D. kube-system

Solution

  1. Step 1: Recall default namespaces

    Kubernetes provides default namespaces like default, kube-system, and kube-public.
  2. Step 2: Identify the correct default namespace

    kube-system is a default namespace for system components, while others are user-defined.
  3. Final Answer:

    kube-system -> Option D
  4. Quick Check:

    kube-system is default namespace [OK]
Hint: Remember kube-system for system pods [OK]
Common Mistakes:
  • Assuming production is default
  • Confusing user namespaces with defaults
  • Thinking development is built-in
3. What will the command kubectl get pods -n default show?
medium
A. Pods in the default namespace
B. All pods in all namespaces
C. Pods in the kube-system namespace
D. No pods, because default namespace is empty

Solution

  1. Step 1: Understand the command syntax

    kubectl get pods -n default lists pods in the namespace named default.
  2. Step 2: Identify the namespace targeted

    The -n default flag limits output to the default namespace only.
  3. Final Answer:

    Pods in the default namespace -> Option A
  4. Quick Check:

    kubectl -n default shows default pods [OK]
Hint: -n specifies namespace for kubectl commands [OK]
Common Mistakes:
  • Thinking it shows pods from all namespaces
  • Confusing default with kube-system
  • Assuming default namespace is always empty
4. You run kubectl get pods but get an error: error: namespace "defaultt" not found. What is the likely cause?
medium
A. Pods do not exist in any namespace
B. The namespace name is misspelled
C. kubectl is not installed
D. The cluster is down

Solution

  1. Step 1: Analyze the error message

    The error says namespace "defaultt" not found, indicating a typo.
  2. Step 2: Check command usage

    Likely the user typed defaultt instead of default as namespace.
  3. Final Answer:

    The namespace name is misspelled -> Option B
  4. Quick Check:

    Namespace typo causes not found error [OK]
Hint: Check spelling of namespace names carefully [OK]
Common Mistakes:
  • Assuming pods don't exist anywhere
  • Blaming kubectl installation
  • Thinking cluster is down without checking
5. You want to deploy an app only visible to system components. Which default namespace should you use?
hard
A. kube-system
B. kube-public
C. default
D. custom-namespace

Solution

  1. Step 1: Understand namespace roles

    kube-system holds system components and is isolated from normal user apps.
  2. Step 2: Choose namespace for system visibility

    Deploying in kube-system makes the app visible only to system components.
  3. Final Answer:

    kube-system -> Option A
  4. Quick Check:

    System apps use kube-system namespace [OK]
Hint: Use kube-system for system-only apps [OK]
Common Mistakes:
  • Using default namespace for system apps
  • Choosing kube-public which is for public info
  • Using a custom namespace without system access
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard