Namespaces and Labels
Part of the Kubernetes course
A cluster with six Pods in it is easy. You run kubectl get pods, you see everything, and you know what each one is. A cluster with six hundred Pods across four teams and three environments is a different object entirely: kubectl get pods becomes a wall of text, two teams both want to call their app api, and deleting "the old test deployment" means picking the right eleven objects out of hundreds by eye.
Kubernetes solves this with two mechanisms that look similar and do completely different jobs. Namespaces divide the cluster into separate areas. Labels attach searchable tags to objects wherever they live. You need both, and knowing which is which saves you a lot of confusion later. ...
Want to learn Kubernetes Namespaces and Labels in a real environment?
Click below, get a fresh Linux box with Kubernetes ready to go, and work through Namespaces and Labels hands-on with an AI tutor that knows your code.
Start this lessonNamespaces and LabelsWhat you'll learn
- Kubectl create namespace
- -n flag
- Default vs kube-system
- Labels
- Selectors
- Kubectl get -l
Read this lesson in your language
All lessons in this course
14 lessons- 1What is Kubernetes25 min
- 2Your First Pod30 min
- 3Deployments and ReplicaSets35 min
- 4Services35 min
- 5Probes and Self-Healing35 min
- 6ConfigMaps and Secrets35 min
- 7Volumes and Persistent Storage35 min
- 8Namespaces and Labels25 min
- 9Ingress35 min
- 10Helm Basics35 min
- 11Scaling and HPA30 min
- 12RBAC35 min
- 13Observability30 min
- 14Capstone: Deploy a Stack60 min
