0
0
Kubernetesdevops~5 mins

Switching namespace context in Kubernetes - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Kubernetes namespace?
A Kubernetes namespace is like a folder that helps organize and separate resources in a cluster. It allows you to group related resources together.
Click to reveal answer
beginner
How do you check the current namespace context in kubectl?
Use the command kubectl config view --minify --output 'jsonpath={..namespace}' to see the current namespace set in your context.
Click to reveal answer
beginner
What command switches the current namespace context to 'dev'?
Run kubectl config set-context --current --namespace=dev to switch your current context to the 'dev' namespace.
Click to reveal answer
beginner
Why is switching namespaces useful in Kubernetes?
Switching namespaces lets you work on different projects or environments without mixing resources. It keeps things organized and safe.
Click to reveal answer
beginner
How to list all namespaces in a Kubernetes cluster?
Use kubectl get namespaces to see all namespaces available in your cluster.
Click to reveal answer
Which command changes your current namespace to 'test'?
Akubectl switch namespace test
Bkubectl config set-context --current --namespace=test
Ckubectl change namespace test
Dkubectl set namespace test
What does a Kubernetes namespace help you do?
AOrganize resources into groups
BIncrease cluster CPU
CChange pod images
DDelete the cluster
How do you see the current namespace your kubectl is using?
Akubectl get current namespace
Bkubectl show namespace
Ckubectl namespace current
Dkubectl config view --minify --output 'jsonpath={..namespace}'
What happens if you don’t specify a namespace in kubectl commands?
Akubectl uses the default namespace
Bkubectl fails with error
Ckubectl deletes all namespaces
Dkubectl creates a new namespace
Which command lists all namespaces in your Kubernetes cluster?
Akubectl list namespaces
Bkubectl show namespaces
Ckubectl get namespaces
Dkubectl namespaces list
Explain how to switch your current kubectl context to a different namespace and why you might want to do this.
Think about how namespaces separate resources and how kubectl context controls where commands run.
You got /3 concepts.
    Describe how to check which namespace your kubectl commands are currently using.
    Look at the kubectl config and how it shows the active namespace.
    You got /3 concepts.