DevOps 工程师可以使用 kubectl edit
命令更新自助命名空间。
前提条件
过程
- 登录到主管集群。
kubectl vsphere login --server IP-ADDRESS-SUPERVISOR-CLUSTER --vsphere-username VCENTER-SSO-USERNAME
- 描述要更新的命名空间。
kubectl describe ns testns-1 Name: testns Labels: vSphereClusterID=domain-c50 Annotations: my-ann: test-ann-2 vmware-system-namespace-owner-count: 2 vmware-system-resource-pool: resgroup-153 vmware-system-resource-pool-cpu-limit: 0.4770 vmware-system-resource-pool-memory-limit: 2000Mi vmware-system-self-service-namespace: true vmware-system-vm-folder: group-v154 Status: Active Resource Quotas Name: testns-1 Resource Used Hard -------- --- --- requests.storage 0 5000Mi Name: testns-1-storagequota Resource Used Hard -------- --- --- namespace-service-storage-profile.storageclass.storage.k8s.io/requests.storage 0 9223372036854775807
- 使用 kubectl edit 命令编辑命名空间。
例如, kubectl edit ns testns-1kubectl edit 命令将在 KUBE_EDITOR 或 EDITOR 环境变量定义的文本编辑器中打开命名空间清单。
- 更新标签。
例如,
my-label=test-label
- 更新注释。
例如,
my-ann: test-ann
- 描述命名空间,查看更新。
root@localhost [ /tmp ]# kubectl describe ns testns-1 Name: testns-1 Labels: my-label=test-label vSphereClusterID=domain-c50 Annotations: my-ann: test-ann vmware-system-namespace-owner-count: 1 vmware-system-resource-pool: resgroup-173 vmware-system-resource-pool-cpu-limit: 0.4770 vmware-system-resource-pool-memory-limit: 2000Mi vmware-system-self-service-namespace: true vmware-system-vm-folder: group-v174 Status: Active Resource Quotas Name: testns-1 Resource Used Hard -------- --- --- requests.storage 0 5000Mi Name: testns-1-storagequota Resource Used Hard -------- --- --- namespace-service-storage-profile.storageclass.storage.k8s.io/requests.storage 0 9223372036854775807 No LimitRange resource.