OpenShift - Label a route using the oc label command

Let's say you use the oc expose service command to create a route named route001.

oc expose service service001 --name route001

 

The oc describe route command can be used to list labels the route has.

~]$ oc describe route route001
Name:                   route001
Namespace:              foo
Created:                About a minute ago
Labels:                 app=webserver54-openjdk8-tomcat9-openshift-rhel8
                        app.kubernetes.io/component=webserver54-openjdk8-tomcat9-openshift-rhel8
                        app.kubernetes.io/instance=webserver54-openjdk8-tomcat9-openshift-rhel8

 

The oc label route command can be used to apply additional labels to the route.

~]$ oc label route route001 route-type=default
route.route.openshift.io/route001 labeled

 

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

~]$ oc describe route route001
Name:                   route001
Namespace:              foo
Created:                About a minute ago
Labels:                 app=webserver54-openjdk8-tomcat9-openshift-rhel8
                        app.kubernetes.io/component=webserver54-openjdk8-tomcat9-openshift-rhel8
                        app.kubernetes.io/instance=webserver54-openjdk8-tomcat9-openshift-rhel8
                        route-type=default

 

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

~]$ oc label route route001 route-type-
route.route.openshift.io/route001 labeled

 




Did you find this article helpful?

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

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |