Kubernetes namespaces partition a Kubernetes cluster into logical isolations. This enables IT teams to organize Kubernetes infrastructure resources so that various users and teams can collaborate while maintaining clear and isolated boundaries.

For example, with Kubernetes namespaces, IT teams can logically isolate development, test, and production environments. Namespaces also provide administrative control over resources, via resource quotas and limits.

When an IT admin first sets up a Kubernetes cluster, four namespaces are automatically created:

  • Default. All the resource deployments without a namespace are deployed under this namespace.
  • kube-system. This namespace holds Kubernetes system configurations and deployments crucial to the Kubernetes cluster.
  • kube-public. This namespace is open to all users with read-only access but reserved for system usage.
  • kube-node-lease. All nodes have an associated Lease object in this namespace. A Lease boosts the performance of the node heartbeats — messages that nodes send to the node controller to indicate availability — as the Kubernetes cluster scales.

Let’s dig deeper and understand how to work with namespaces. As a prerequisite, have a Kubernetes cluster up and running before attempting the commands.

Query namespaces

Run the following commands to receive the list of all namespaces or a specific namespace in Kubernetes:

kubectl get namespaces
kubectl get namespaces <name of namespace>

This will produce an output similar to Figure 1.

Kubernetes namespaces
Figure 1. List Kubernetes namespaces

For more detailed information about a namespace, use the describe command:

kubectl describe namespaces <name of namespace>

 

[Read More on TechTarget.com]

 

Optical Character Recognition

Author of “PowerShell Guide to Python“, “Windows Subsystem for Linux (WSL)” and currently writing the most awaited book: “PowerShell to C# and Back” !


Subscribe to our mailing list

* indicates required