Kubernetes Labels and Annotations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 6: Line 6:
=<span id='Label'></span>Labels=
=<span id='Label'></span>Labels=


A label contains identifying information.  
A label contains identifying information used to organize and categorize (scope and select) objects.


Labels are used by selector queries, or within selector sections of object definitions.  
Labels are used by selector queries, or within selector sections of object definitions. Replication controllers and services use selectors to identify the pods that fall under their scope.


The structure of keys and values is constrained, so they can be evaluated quickly.  
The structure of keys and values is constrained, so they can be evaluated quickly.  
Line 15: Line 15:


For a specific object declaration, the labels are specified in the [[Kubernetes Manifest Metadata|metadata]] section of the [[Kubernetes_Manifests#metadata|manifest]].
For a specific object declaration, the labels are specified in the [[Kubernetes Manifest Metadata|metadata]] section of the [[Kubernetes_Manifests#metadata|manifest]].
More info: http://kubernetes.io/docs/user-guide/labels


=<span id='Annotation'></span>Annotations=
=<span id='Annotation'></span>Annotations=


An annotation contains non-identifying information. The information exposed by annotations is not used internally by Kubernetes. They cannot be used in selectors. The annotation keys and values are not constrained.
An annotation contains non-identifying information. The information exposed by annotations is not used internally by Kubernetes. They cannot be used in selectors. The annotation keys and values are not constrained.

Revision as of 01:02, 7 September 2019

Internal


Labels

A label contains identifying information used to organize and categorize (scope and select) objects.

Labels are used by selector queries, or within selector sections of object definitions. Replication controllers and services use selectors to identify the pods that fall under their scope.

The structure of keys and values is constrained, so they can be evaluated quickly.

TODO: Label syntax and character set: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set.

For a specific object declaration, the labels are specified in the metadata section of the manifest.


More info: http://kubernetes.io/docs/user-guide/labels

Annotations

An annotation contains non-identifying information. The information exposed by annotations is not used internally by Kubernetes. They cannot be used in selectors. The annotation keys and values are not constrained.