Namespaces
Last updated
Last updated
▪ Namespaces are a way to organize clusters into virtual sub-clusters — they can be helpful when different teams or projects share a Kubernetes cluster. Any number of namespaces are supported within a cluster, each logically separated from others but with the ability to communicate with each other. Namespaces cannot be nested within each other.
▪ Any resource that exists within Kubernetes exists either in the default namespace or a namespace that is created by the cluster operator. Only nodes
and persistent storage volumes
exist outside the namespace; these low-level resources are always visible to every namespace in the cluster.
▪ Namespaces provide a mechanism for isolating groups of resources within a single cluster
▪ Like a virtual cluster inside a cluster
default: By default all the resource created in Kubernetes cluster are created in the default namespace
. By default, the default namespace
can allow applications to run with unbounded CPU and memory requests/limits (Until someone set resource quota for the default namespace
).
kube-public: Namespace for resources that are publicly readable by all users. This namespace is generally reserved for cluster usage.
kube-system: It is the Namespace for objects created by Kubernetes systems/control plane.
kube-node-lease—a default space for objects related to cluster scaling.
The following command is used to control the namespace.
In the above code,
We are using the command to create a namespace.
This will list all the available namespace.
This will get a particular namespace whose name is specified in the command.
This will describe the complete details about the service.
This will delete a particular namespace present in the cluster.
Following is an example of a sample file for using namespace in service.
In the above code, we are using the same namespace under service metadata with the name of elk.