Annotations

Annotations are key/value pairs like labels, BUT:

  • you don't use them for querying objects (you simply use them as metadata for clients/tools/libraries)
  • you can write a really long value, including with characters that are not supported by labels.

Working with annotations

Annotations in the descriptor

apiVersion: v1
kind: Pod
metadata:
  name: annotations-demo
  annotations:
    imageRegistry: 'https://hub.docker.com/'
    createdBy: |
      {"kind":"SerializedReference", "apiVersion":"v1",
      "reference":{"kind":"ReplicationController", "namespace":"default", ...
spec:
  containers: ...

Adding or modifying annotations

kubectl annotate pod kubia-manual mycompany.com/someannotation="foo bar"
# pod "kubia-manual" annotated

Viewing annotations

kubectl describe pod kubia-manual
# ...
# Annotations: mycompany.com/someannotation=foo bar
# ...

References