Kubernetes interview question · Most asked

What are Kubernetes namespaces, when should you create them, and what isolation do they provide?

Definition Asked in DevOps Engineer · Site Reliability Engineer (SRE) · Cloud Engineer interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Namespaces partition a cluster into virtual sub-clusters that scope names, RBAC policies, resource quotas and network policies. They isolate teams and environments logically but do not isolate workloads at the network or node level by themselves.

Longer Answer

Every object in Kubernetes lives in a namespace (except cluster-scoped objects like Nodes, PersistentVolumes and ClusterRoles). The default namespace exists out of the box, but production clusters create additional namespaces for:

  • Team or service boundaries: team-payments, team-search — each team gets its own RBAC bindings and resource quotas.
  • Environment separation in a shared cluster: staging, production — though separate clusters are safer for true production isolation.
  • System workloads: kube-system, monitoring, ingress — keep platform components separate from application workloads.

What namespaces isolate:

  • Names: two Deployments can both be called api if they're in different namespaces.
  • RBAC: a RoleBinding scoped to a namespace limits who can read or write its resources.
  • ResourceQuota / LimitRange: caps CPU, memory and object counts per namespace.
  • NetworkPolicy: rules are namespace-scoped, so a default-deny policy in one namespace doesn't affect another.

What they don't isolate:

  • Network by default: pods in different namespaces can still reach each other unless NetworkPolicies deny it.
  • Nodes: pods from any namespace can land on any node unless you add taints or node affinity.
  • Cluster-scoped resources: ClusterRoles, PVs, Nodes and CRDs are shared.

A common anti-pattern is creating one namespace per microservice — this adds operational overhead without meaningful isolation. Group by team or bounded context instead.

Key Points

  • Namespaces scope names, RBAC, quotas and network policies within a cluster
  • They do not isolate network traffic by default — NetworkPolicies are needed for that
  • Create them per team or bounded context, not per microservice
  • Cluster-scoped resources (Nodes, PVs, ClusterRoles) are shared across all namespaces

Explanation

What interviewers look for

Look for understanding of what namespaces do and don't isolate. Weak answers treat namespaces as full security boundaries. Strong answers mention that network isolation requires NetworkPolicies and that node isolation needs taints/affinity.

More Kubernetes questions

← All Kubernetes questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake