Member-only story

Importance of labeling and annotating your Kubernetes objects

Ishan Liyanage
2 min readDec 5, 2020

--

Labels and Selectors are a standard method to group things together.

Lets say you have different objects/things and you want filter them based on different criteria.

If we have labeled those objects, you can easily filter them based on different criteria such as their color, type, shape etc..

Even you can use multiple criteria to fine tune your filter.

In other words, labels are properties attached to each item. So you add properties to each item based on their type, color, purpose and you use selectors to filter them based on same criteria.

For example when we say color=red, we will get list of items with color red.

In real world examples, we use labels (tags) to categorized many things such as Youtube videos, Blog articles or online store items. So the uses can select them based on such properties.

So how are labels and selectors use in kubernetes

We can create lots of different object types in kubernets such as PODs, Services, Replica Sets, Deployments. Over the time, we may end up having hundreds of such objects in our cluster.

we may end up having hundreds of different k8s objects

--

--

Ishan Liyanage
Ishan Liyanage

Written by Ishan Liyanage

Passionate Technical Lead, Senior Software Developer and free and open source software advocate. Based in Singapore.

No responses yet

Write a response