Kubernetes is a container orchestration system that allows you to group and run containers. Kubernetes namespaces allow admins to create groups of resources with specific access requirements. Kubernetes namespaces can be used for many different purposes, such as running services on different hosts or limiting network traffic between two sets of pods.
Kubernetes namespaces can be created according to your needs, and Kubernetes has a number of default options that you may not need.
Kubernetes Namespace Requirements
You must have the Kubernetes cluster role “cluster” in order to create Kubernetes namespaces. In addition, if you are not logged in to the Kubernetes master node, you must have “admin” permissions for Kubernetes.
Default Kubernetes Namespaces
Kubernetes comes with a number of default namespaces that can be used by users who do not need custom Kubernetes namespace configurations. The following Kubernetes namespaces are available by default:
default kube-node-lease kube-public kube-system
The kube-system namespace is started during Kubernetes cluster creation, and cannot be deleted or modified from within your running Kubernetes cluster. The kube-system namespace contains Kubernetes system objects, including the Kubernetes API Server, the Kubernetes Scheduler, and the Etcd storage backend for Kubernetes configuration data.
The default namespace is created when you first create a Kubernetes cluster. Kubernetes Pods are assigned to the default namespace by default, which means that Kubernetes objects exist in both namespaces if you don’t specify a particular Kubernetes Namespace when creating them.
The Kubernetes Kube-node-lease namespace is a special Namespace that is used to manage Kubernetes node leases. A node lease is a temporary allocation of a node for use by a Kubernetes deployment. When you create a Kubernetes deployment, Kubernetes determines which nodes are available to run the deployment. Kubernetes then selects a node from the pool of available nodes and assigns it to the deployment. The node lease is used to track the selected node, and to ensure that the node remains allocated to the deployment until it is deleted or released. If Kubernetes needs to move a Kubernetes deployment to another node, Kubernetes will first release the existing lease on the original node. Kubernetes then allocates a new lease for the Kubernetes pod running on that node.
The kube-public namespace is a Kubernetes namespace that is designed for Kubernetes clusters. Kubernetes uses kube-public namespace to store publicly accessible Kubernetes resources. Kubernetes public resources include Kubernetes Dashboard, Kubernetes API server, and Kubernetes web interfaces.
Kubernetes Namespace Commands
The following kubectl commands can be used to manage Kubernetes namespaces (use kubectl command namespace )
get – Shows information about a specific Kubernetes namespace.
create – Creates a new Kubernetes namespace.
delete – Deletes a Kubernetes namespace.
rename – Renames a Kubernetes namespace.