Kubernetes Namespaces 相关命令

Kubernetes About 756 words

作用

多套环境的资源隔离或者多租户的资源隔离。

结合资源配额机制,限定不同租户能占用的资源,例如CPU使用量、内存使用量等,实现租户可用资源的管理。

查看命名空间

namespace可简写为ns

kubectl get namespace

输出:

[root@k8s-master ~]# kubectl get ns
NAME              STATUS   AGE
default           Active   13h
kube-node-lease   Active   13h
kube-public       Active   13h
kube-system       Active   13h

创建命名空间

kubectl create ns dev

查看描述信息

kubectl describe ns dev

输出:

[root@k8s-master ~]# kubectl describe ns dev
Name:         dev
Labels:       kubernetes.io/metadata.name=dev
Annotations:  <none>
Status:       Active

No resource quota.

No LimitRange resource.

删除命名空间

kubectl delete ns dev

yml 方式

编写 yml

命名为:ns-dev.yml

apiVersion: v1
kind: Namespace
metadata:
  name: dev

创建

kubectl create -f ns-dev.yml

删除

kubectl delete -f ns-dev.yml
Views: 1,109 · Posted: 2022-03-07

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh