Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

108.3. namespace 命名空间

108.3.1. 查看命名空间

			
root@netkiller ~# kubectl get ns
NAME              STATUS   AGE
default           Active   197d
kube-system       Active   197d
kube-public       Active   197d
kube-node-lease   Active   197d
longhorn-system   Active   195d
test              Active   163d
gitlab            Active   156d
dev               Active   155d
training          Active   133d
project           Active   24h

root@netkiller ~# kubectl get namespace
NAME              STATUS   AGE
default           Active   197d
kube-system       Active   197d
kube-public       Active   197d
kube-node-lease   Active   197d
longhorn-system   Active   195d
test              Active   163d
gitlab            Active   156d
dev               Active   155d
training          Active   133d
project           Active   24h			
			
			

108.3.2. 创建命名空间

			
$ kubectl create namespace new-namespace		
			
			

108.3.3. 使用 yaml 创建命名空间

创建 jenkins-namespace.yaml

			
apiVersion: v1
kind: Namespace
metadata:
  name: jenkins-project
			
			
			
$ kubectl create -f jenkins-namespace.yaml
namespace ”jenkins-project“ created			
			
			

108.3.4. 删除命名空间

			
root@netkiller ~# kubectl delete namespace new-namespace
namespace "new-namespace" deleted