You have a functioning Kubernetes cluster and want to deploy pods or replication controllers in a separate namespace (other than default).

The first thing you need to do is create a yaml file defining Namespace as the "kind" parameter.

Below is an example yaml file (foobar.namespace.yaml) with a namespace of foobar.

# cat foobar.namespace.yaml
  "kind": "Namespace",
  "apiVersion": "v1",
  "metadata": {
    "name": "foobar",
    "labels": {
      "name": "foobar"


Run the kubectl command to create the namespace.

# kubectl create -f foobar.namespace.yaml

Verify the namespace was created:

# kubectl get namespaces
NAME              LABELS                 STATUS
default           <none>                 Active
foobar            name=foobar            Active

To delete the namespace:

# kubectl delete namespace foobar

For additional information on Kubernetes namespaces, vist