Namespaces

Namespaces are a way to separate groups of resources within a single Kubernetes cluster. The names of resources must be different within a namespace, but they can be the same between namespaces.

When many teams or projects share a Kubernetes cluster, namespaces provide a means to divide clusters into virtual sub-clusters.

A cluster can support any number of namespaces, each of which can interact with the others despite being logically isolated from the others. A namespace cannot be nested inside of another namespace.

Any resource in Kubernetes may be found in either the default namespace or a namespace that the cluster operator defines.

Benefits of Namespaces

  1. Allowing teams or projects to existing in their own virtual clusters.

  2. Role-based access controls (RBAC)

  3. Simple method for separating containerized application

  4. Resource quotas

Default Namespaces in K8s

  1. Default

The namespace for objects that have no other namespace.

  1. Kube-System

The namespace for Kubernetes-created objects.

  1. Kube-Public

This namespace is generated automatically and can be accessed by all users (including those not authenticated). This namespace is mostly reserved for cluster use, in case some resources need to be publicly visible and readable across the entire cluster. This namespace public aspect is merely a convention, not a requirement.

  1. Kube-Node-Lease

This namespace is generated automatically and can be accessed by all users (including those not authenticated). This namespace is mostly reserved for cluster use, in case some resources need to be publicly visible and readable across the entire cluster. This namespace’s public aspect is merely a convention, not a requirement.

Sample Namespace File

apiVersion: v1
kind: Namespace
metadata:
  name: <insert-namespace-name-here>

Last updated