Create a Namespace
Creating a namespace is pretty simple. The kubectl command does the magic. You don’t need to have a YAML file:
root@test3:~# kubectl create ns dev
namespace/dev created
And the new namespace dev is now created:
root@test3:~# kubectl get ns
NAME STATUS AGE
default Active 15d
dev Active 5s #<-----
Now the webserver1 pod in dev namespace won’t conflict with webserver1 pod in the sales namespace:
$ kubectl get pod --all-namespaces -o wide NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE dev webserver1 1/1 Running 4 2d4h 10.47.255.249 cent222 <none> sales webserver1 1/1 Running 4 2d4h 10.47.255.244 cent222 <none>