What are namespaces, and what are the default ones Kubernetes ships with?
Quick Answer
Namespaces are virtual clusters that scope and isolate names, RBAC, quotas, and network policy within one physical cluster. The built-in ones are default, kube-system, kube-public, and kube-node-lease.
Detailed Answer
A namespace partitions cluster resources so teams or environments can coexist: object names must be unique per namespace (not cluster-wide), and you attach RBAC roles, ResourceQuotas, LimitRanges, and NetworkPolicies per namespace. The defaults: default is where your objects go if you don't specify one; kube-system holds control-plane and add-on components (CoreDNS, kube-proxy); kube-public is world-readable cluster info; kube-node-lease holds node heartbeat lease objects that make node health detection scalable. Note that not everything is namespaced — nodes, PersistentVolumes, and ClusterRoles are cluster-scoped. Namespaces provide a soft boundary; for hard multi-tenancy you add quotas, network policy, and RBAC, or separate clusters.
Code Example
kubectl get ns # default, kube-system, kube-public, kube-node-lease kubectl create ns team-payments kubectl -n team-payments get all kubectl api-resources --namespaced=false # cluster-scoped kinds
Interview Tip
Add that namespaces are a *soft* boundary — real isolation needs RBAC + ResourceQuota + NetworkPolicy on top. And note cluster-scoped objects (nodes, PVs) aren't namespaced.