As a DevOps engineer you can update self-service namespaces using the kubectl edit
command.
Prerequisites
Procedure
- Log in to the Supervisor Cluster.
kubectl vsphere login --server IP-ADDRESS-SUPERVISOR-CLUSTER --vsphere-username VCENTER-SSO-USERNAME
- Describe the namespace that you want to update.
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
- Edit the namespace using the kubectl edit command.
For example, kubectl edit ns testns-1The kubectl edit command opens the namespace manifest in the text editor defined by your KUBE_EDITOR or the EDITOR environment variable.
- Update the labels.
For example,
my-label=test-label
- Update the annotations.
For example,
my-ann: test-ann
- Describe the namespace to see the updates.
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.