✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Kubernetes Built In Namespace Usage

Kubernetes uses built-in namespaces to isolate resources, enabling organized and secure management of clusters through predefined namespace scopes.

Kubernetes Built In Namespace Usage is the correct understanding and handling of the four namespaces every Kubernetes cluster provisions automatically at creation — default, kube-system, kube-public, and kube-node-lease — each serving a specific, largely non-negotiable purpose that differs from the general-purpose, organization-defined namespaces teams create for their own workloads. Because these namespaces exist before any administrator makes an explicit organizational decision, and because some of them host critical cluster infrastructure, understanding their intended purpose (and, for default in particular, the operational discipline of avoiding accidental reliance on it) is foundational cluster hygiene distinct from the broader namespace organization strategies applied to custom namespaces.

Each built-in namespace has a narrow, specific role that should generally not be repurposed for ordinary application workloads, since doing so blurs the boundary between cluster infrastructure and application concerns that these namespaces are specifically meant to keep separate.


default

The Implicit Fallback Namespace

Every kubectl command or manifest that does not explicitly specify a namespace targets default implicitly — this makes it a convenient namespace for quick experimentation, but a risky one to rely on for any real workload, since objects can end up there simply because a -n flag or namespace: field was forgotten.

kubectl config set-context --current --namespace=codartium-team

Why Production Workloads Should Avoid It

Because default accumulates whatever objects anyone forgot to place elsewhere, applying ResourceQuota or NetworkPolicy scoped to it is far less predictable than doing the same for a deliberately created, purpose-specific namespace — production workloads are almost universally deployed into dedicated, explicitly named namespaces instead, leaving default largely empty by convention.


kube-system

Home for Core Cluster Components

kube-system hosts the control plane's own components when they run as Pods (kube-dns/CoreDNS, kube-proxy, and, in self-managed clusters, the API server, scheduler, and controller-manager themselves as static Pods) — it is squarely cluster infrastructure territory, not a place for application workloads.

kubectl get pods -n kube-system

Elevated Caution Required

Because a misconfiguration or accidental deletion within kube-system can disrupt fundamental cluster functionality (DNS resolution, kube-proxy's network rules) affecting every namespace simultaneously, changes here warrant the same elevated review discipline applied to other high-blast-radius cluster-scoped changes — most organizations restrict write access to kube-system to a small platform team via RBAC, rather than granting it broadly.


kube-public

A Deliberately Readable Namespace

kube-public is configured, by convention (via RBAC), to be readable by all users, including unauthenticated ones in some cluster configurations — its original intended purpose was publishing cluster information that legitimately needs to be discoverable before authentication, such as bootstrap information used by kubeadm.

kubectl get configmaps -n kube-public

Limited, Specific Modern Usage

In practice, most clusters store very little in kube-public beyond what bootstrap tooling places there automatically — it is not a general-purpose namespace for teams to use, and placing arbitrary application data there would inherit its unusually open readability, which is rarely a property any application workload actually wants.


kube-node-lease

Node Heartbeat Tracking

kube-node-lease holds Lease objects, one per node, used by the kubelet to report node heartbeats efficiently — this namespace exists specifically to offload frequent, lightweight heartbeat updates from the heavier Node object status updates that were used for this purpose in older Kubernetes versions, improving control plane scalability for large clusters.

kubectl get leases -n kube-node-lease

Not a Namespace for General Use

This namespace has an extremely narrow, single-purpose function tied directly to node lifecycle tracking — there is no legitimate reason for application workloads or custom objects to be placed here, and its contents are managed entirely by the kubelet and control plane automatically.


Practical Guidance

Treat Built-In Namespaces as Read-Mostly Infrastructure

Aside from kube-system (where platform teams do legitimately deploy cluster add-ons), the built-in namespaces are best treated as infrastructure to observe and understand rather than to actively populate with new objects — application and team workloads belong in deliberately created, well-governed custom namespaces following the organization's chosen naming and metadata conventions.

kubectl get namespaces

Example

kubectl get pods -n kube-system -o wide
kubectl get leases -n kube-node-lease --no-headers | wc -l
kubectl config set-context --current --namespace=codartium-team