In our manifest file, under spec.template.metadata.labels, we've specified that our Elasticsearch Pods should carry the label app: elasticsearch.
Label is one of two methods to attach arbitrary metadata to Kubernetes Objects, with the other being annotations.
Both labels and annotations are implemented as key-value stores, but they serve different purposes:
- Labels: Used to identify an Object as belonging to a certain group of similar Objects. In other words, it can be used to select a subset of all Objects of the same type. This can be used to apply Kubernetes commands to only a subset of all Kubernetes Objects.
- Annotations: Any other arbitrary metadata not used to identify the Object.
A label key consists of two components—an ...