Namespaces are "airtight" compartments where we put resources that belong together.
Some resources in kubernetes live in a namespace - called namespaced - like the deployments and services, others are cluster resources and don't belong to any particular namespace, like nodes and volumes.
Namespaces are also used by RBAC - Role Based Access Control - to give authorizations to resources based on their namespace.
We can create a namespace on the command line using the below command:
We can run commands in our newly created namespace by mentioning it on the command line using the flag "--namespace".
For example, to display the pods that live in our namespace, we use the below command:
To make our namespace the default namespace, so we would not have to mention it in all our subsequent commands, we use the below command: