Create New Namespaces
You can create your namespace by using the command.
$ kubectl create namespace your-namespace
As you can see we have successfully created namespace gfg.
Creating Component in a Namespace:
To create a component in a namespace you can either give the –namespace flag or specify the namespace in the configuration file.
Method 1: Using –namespace flag
$ kubectl apply -f your_config.yaml --namespace=your-namespace
then you can check resources in your namespace using kubectl get and specify namespace using -n
Kubernetes – Namespaces
Pre-requisite:- Kubernetes
Kubernetes Namespace is a mechanism that enables you to organize resources. It is like a virtual cluster inside the cluster. A namespace isolates the resources from the resources of other namespaces. For example, You need to have different names for deployments/services in a namespace but you can have the same name for deployment in two different namespaces.