What are Kubernetes namespaces for?
Options
- To encrypt the traffic that moves between the pods of the cluster
- To split one cluster into sections with names, quotas and permissions (Correct option)
- To store the container images that belong to each team
- To schedule jobs at fixed times of the day inside the cluster
Answer
To divide one cluster into logical virtual sections (e.g. dev, staging, team-a) with separate names, quotas and permissions
Why
A namespace is a folder-like boundary inside a cluster. Two teams or environments can both have a Service called api without clashing.
You can attach resource quotas and access rules (RBAC) per namespace. Default namespaces: default, kube-system (cluster components).
Use kubectl get pods -n staging to choose one.
Remember
Namespace = logical partition of a cluster.