As a DevOps engineer you can update or delete self-service namespace annotations and labels using the kubectl annotate and kubectl label commands.

Prerequisites

Verify that you have owner permissions on the namespace that you want to update.

Procedure

  1. Log in to the Supervisor Cluster.
    kubectl vsphere login --server IP-ADDRESS-SUPERVISOR-CLUSTER --vsphere-username VCENTER-SSO-USERNAME
  2. Describe the namespace that you want to update.
    root@localhost [ /tmp ]# kubectl describe ns testns
    Name:         testns
    Labels:       my-label=test-label-2
                  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
     Resource          Used  Hard
     --------          ---   ---
     requests.storage  0     5000Mi
     
     
     Name:                                                                           testns-storagequota
     Resource                                                                        Used  Hard
     --------                                                                        ---   ---
     namespace-service-storage-profile.storageclass.storage.k8s.io/requests.storage  0     9223372036854775807
  3. Update annotations using the kubectl annotate command.
    For example, kubectl annotate --overwrite ns testns my-ann="test-ann-3"
    To delete an annotation, run the command kubectl annotate --overwrite ns testns my-ann-
  4. Update labels using the kubectl label command.
    For example, kubectl label --overwrite ns testns my-label="test-label-3"
    To delete a label, run the command kubectl label --overwrite ns testns my-label-
  5. Describe the namespace to see the updates.
    root@localhost [ /tmp ]# kubectl describe ns testns
    Name:         testns
    Labels:       my-label=test-label-3
                  vSphereClusterID=domain-c50
    Annotations:  my-ann: test-ann-3
                  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
     Resource          Used  Hard
     --------          ---   ---
     requests.storage  0     5000Mi
     
     
     Name:                                                                           testns-storagequota
     Resource                                                                        Used  Hard
     --------                                                                        ---   ---
     namespace-service-storage-profile.storageclass.storage.k8s.io/requests.storage  0     9223372036854775807
     
     
    No LimitRange resource.