kubectl describe ns default
$ cat namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: main
labels:
name: main
$ kubectl get ns NAME STATUS AGE default Active 22h kube-public Active 22h kube-system Active 22h
$ kubectl apply -f namespace.yaml
$ kubectl get ns NAME STATUS AGE default Active 22h kube-public Active 22h kube-system Active 22h main Active 3h
$ kubectl get namespaces --show-labels $ kubectl describe ns main $ kubectl describe ns default
$ kubectl config set-context main --namespace=main --cluster=${NAME} --user=${NAME}
Context "main" modified.
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
default cluster
* main cluster cluster main
$ kubectl config use-context main
https://vitalflux.com/kubernetes-create-delete-namespaces-namespaces/