Kubernetes 101 : Pod Labels - Adding and modifying labels -
We could also display the pods and their labels using the below command:
Below is an example of Yaml file of a pod named - pod-label -:
We create the pod using the below command:
We check if our pod was created, using the below command - -l for label -:
Then, we use the below command to modify the "app=nginx" label to "app=nginx-1" for the - pod-label - pod, using the below command:
We could check whether the label has been modified, using the below command, and looking for the "Labels: app=nginx-1" line":
We could delete the label with the "app" key using the "kubectl label" command:
Comments