xxxxxxxxxx
demo-namespace.yml
apiVersion: v1
kind: Namespace
metadata:
name: demo
labels:
env: dev
$ kubectl create -f demo-namespace.yml
$ kubectl get namespaces -o=json
$ kubectl get namespaces demo -o=json/yaml/name
xxxxxxxxxx
Namespaces are a way to organize clusters into virtual sub-clusters — they can be helpful when different teams or projects share a Kubernetes cluster. Any number of namespaces are supported within a cluster, each logically separated from others but with the ability to communicate with each other.