Default Namespaces in Kubernetes

An explanation of the four default Kubernetes namespaces: kube-system, kube-public, kube-node-lease, and default, including their purposes and usage guidelines.

When you set up a Kubernetes (k8s) cluster, several Namespaces are automatically created in the initial state. Namespaces are virtual partitions for logically separating resources within the cluster, useful for organizing and managing resources by team, project, or environment.

The four main Namespaces created by default are as follows.

1. kube-system

  • Purpose: The Namespace where Kubernetes cluster system components and addons are deployed.
  • Content: Core component Pods such as kube-apiserver, kube-controller-manager, kube-scheduler, and etcd, as well as addons like DNS services (CoreDNS) and the Kubernetes Dashboard, are placed in this Namespace.
  • Note: Direct manipulation of resources in this Namespace by users is generally not recommended.

2. kube-public

  • Purpose: A Namespace for placing resources that are readable by all users.
  • Content: Primarily contains cluster information and ConfigMaps shared across the entire cluster. For example, it may include information needed for cluster discovery.
  • Note: Sensitive information or user-specific data should not be placed in this Namespace.

3. kube-node-lease

  • Purpose: A Namespace for storing heartbeat information for each node (signals indicating that a node is operating normally).
  • Content: Contains Lease objects corresponding to each node. This improves the performance of node health checks in large-scale clusters.
  • Note: Users typically do not directly manipulate resources in this Namespace.

4. default

  • Purpose: The Namespace where resources are deployed by default when no Namespace is explicitly specified during resource creation.
  • Content: User-created application Pods, Services, Deployments, and other resources are placed in this Namespace unless otherwise specified.
  • Note: While the default Namespace is often used in small clusters or for learning purposes, in production environments or when running multiple applications, it is recommended to create and use custom Namespaces to avoid resource conflicts and management complexity.

Understanding these default Namespaces is important for grasping the basic operation and management of a Kubernetes cluster.

References