Kubernetes annotations - non-identifying metadata for tools, with key rules and the 256 KiB limit
Answer: Annotations, like labels, are key/value maps under metadata.annotations. Annotations attach arbitrary non-identifying metadata to objects for tools and libraries to read; unlike labels, they are not used to identify and select objects.
Example
apiVersion: v1
kind: Pod
metadata:
name: annotations-demo
annotations:
imageregistry: "https://hub.docker.com/"
example.com/git-commit: "a1b2c3d"
spec:
containers:
- name: nginx
image: nginx:1.14.2
kubectl annotate pod annotations-demo example.com/owner=team-a
kubectl annotate pod annotations-demo example.com/owner-
Labels versus annotations
| | Labels | Annotations | |---|---|---| | Select objects | can be used to select objects | not used to select objects | | Value characters | restricted | any string, including JSON or YAML | | Size | small | small or large, structured or unstructured |
An object can use labels as well as annotations at the same time.
Key and value rules
- Keys and values must be strings; numeric, boolean or list types are not allowed.
- A key is an optional prefix and a name separated by
/. The name must be 63 characters or less, beginning and ending with an alphanumeric character. - The prefix must be a DNS subdomain of at most 253 characters. Without a prefix, the key is presumed to be private to the user.
- Automated components that annotate end-user objects must specify a prefix.
kubernetes.io/andk8s.io/are reserved for Kubernetes core components. - The total size of all annotations on one object, keys and values combined, must not exceed 256 KiB. Base64 encode binary data.
Typical uses
- Build, release, or image information such as git branch, PR numbers and image hashes.
- Pointers to logging, monitoring, analytics, or audit repositories.
- Directives from the end-user to modify behavior or engage non-standard features.
See also
Claims
- id: C1 claim: Annotations are not used to identify and select objects. source: S2 evidence: "annotations are not used to identify and select objects."
- id: C2 claim: All annotations on an object must not exceed 256 KiB. source: S2 evidence: "must not exceed 256 KiB."
- id: C3 claim: kubernetes.io/ and k8s.io/ prefixes are reserved. source: S1 evidence: "The kubernetes.io/ and k8s.io/ prefixes are reserved for Kubernetes core components."
Sources
- [S1] Annotations. Kubernetes docs. https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] annotations.md (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/overview/working-with-objects/annotations.md . License: CC-BY-4.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Annotations; kubernetes/website (GitHub), annotations.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Annotations; kubernetes/website (GitHub), annotations.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "Kubernetes annotations - non-identifying metadata for tools, with key rules and the 256 KiB limit." iinventedlight Library, iil:note:1er95709, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-annotations/. License: CC-BY-4.0.
@misc{iil_note_1er95709,
author = {{iinventedlight}},
title = {{Kubernetes annotations - non-identifying metadata for tools, with key rules and the 256 KiB limit}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-annotations/},
note = {Permanent ID iil:note:1er95709. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- kubernetes-annotations.table.json (table; CC-BY-4.0)
- kubernetes-annotations.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-annotations.md.