Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called Namespaces.
Namespaces allow you to create virtual clusters within the same physical cluster.
Namespaces create virtual clusters within a physical Kubernetes cluster.
Namespaces is a logical entity that is used to organize the Kubernetes Cluster into virtual sub-clusters.
Namespaces is used when an organization shares the same Kubernetes cluster for multiple projects.
Namespaces are intended for use in environments with many users spread across multiple teams, or projects.
Can have multiple Namespaces inside a single Kubernetes cluster, and they are all logically isolated from each other.
There can be any number of Namespaces can be created inside the Kubernetes cluster.
Nodes and Volumes do not come under the Namespaces and are visible to every Namespace.
By default, all resources in a Kubernetes cluster are created in a 'default' namespace.
Namespaces are a way to divide cluster resources between multiple users via resource quotas.
The default Namespace in Kubernetes are

$ kubectl get ns
$ kubectl get namespace
$ kubectl get namespaces
NAME              STATUS   AGE
default           Active   1d
kube-node-lease   Active   1d
kube-public       Active   1d
kube-system       Active   1d

Kubernetes starts with four initial Namespaces:
• default 
The default namespace for any objects with no other Namespace.
So whenever we create any Kubernetes object such as pod, replicas, ..etc it will create in the default Namespace.
If want to create the particular pod in the different namespace you have to create the namespace and while creating the pod you have to mention the Namespace.
• kube-system 
The namespace for objects created by the Kubernetes system.
This namespace contains the Kubernetes components such as kube-controller-manager, kube-scheduler, kube-dns or other controllers.
This namespace must be avoided to create objects if want to keep the Kubernetes cluster stable.
• kube-public 
This namespace is created automatically and is readable by all users (including those not authenticated). 
This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. 
The public aspect of this namespace is only a convention, not a requirement. (OR) Used for public resources. Not recommended for use by users.
Resources that should be made available to all users are created here. Any objects here are available without authentication.
• kube-node-lease 
This namespace holds Lease objects associated with each node. 
Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.

# Using Kubernetes Namespaces to Manage Environments
• Kubernetes provides is the ability to manage various environments easier and better than traditional deployment strategies.
• The applications, you have test, staging, and production environments. 
• You can spin up a separate cluster of resources, such as VMs, with the same configuration in staging and production, but that can be costly and managing the differences between the environments can be difficult.
• Kubernetes includes a cool feature called Namespaces, which enable you to manage different environments within the same cluster.
• For example, you can have different test and staging environments in the same cluster of machines, potentially saving resources. You can also run different types of server, batch, or other jobs in the same cluster without worrying about them affecting each other.
