Bootstrap FreeKB - OpenShift - Label a pod using the oc label command
OpenShift - Label a pod using the oc label command

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

A node contains one or more pods, and each pod contains one or more containers.

 

The oc label pod command can be used to apply one or more labels to a pod. In this example, label region=east is applied to the pod named my-app-c4v5h.

~]$ oc label pod my-app-c4v5h region=east
pod/my-app-c4v5h labeled

 

And the oc describe pod command can be used to see the labels that have been applied to the pod.

~]$ oc describe pod my-app-c4v5h
Name:         my-app-c4v5h
Namespace:    foo
Priority:     0
Node:         worker-hsjrp/10.84.188.68
Start Time:   Tue, 26 Jul 2022 07:22:41 -0500
Labels:       region=east

 

And here is how you can remove a label. In this example, the region label will be removed.

~]$ oc label pod my-app-c4v5h region-
pod/my-app-c4v5h labeled

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter b1e994 in the box below so that we can be sure you are a human.