Course contentsShow
← Cloud and Infrastructure
Lesson 1124 of 2,98922. Kubernetes ArchitectureFree lesson

Annotations for Metadata

Learn to use annotations for storing non-identifying metadata and tool-specific information.

Annotations for Metadata

What you'll learn: How to attach non-identifying metadata to Kubernetes objects using annotations for tool integration and documentation.

What Are Annotations?

While labels help Kubernetes select and organize resources, annotations store arbitrary metadata that doesn't affect selection or scheduling. Think of annotations like sticky notes on a file folder—they provide helpful context and information without changing how the system files or finds the folder.

Annotations hold data that tools, libraries, or humans might need later: build information, configuration hints, contact details, or timestamps. Unlike labels, annotations can contain larger values and special characters.

How Annotations Differ from Labels

Labels (covered in lesson 1123) are for identification and selection—Kubernetes uses them to group and filter resources. Annotations are purely informational. You'd never query "find all pods with annotation X"—that's a label's job.

Common Use Cases

apiVersion: v1
kind: Pod
metadata:
  name: my-app
  annotations:
    buildVersion: "2.3.1"
    contact: "team-platform@company.com"
    description: "Processes user uploads"
    deployment-timestamp: "2024-01-15T10:30:00Z"

Annotations typically store:

  • Build metadata: version numbers, commit SHAs, build dates
  • Tool integration: configuration for monitoring, security scanners, or service meshes
  • Documentation: descriptions, ownership, runbook links
  • Operational data: last restart reason, scaling triggers

The Syntax

Annotations follow the same key-value format as labels but with fewer restrictions. Keys use the optional prefix pattern (example.com/key), but values can be much longer and include structured data like JSON.

Key Takeaway: Annotations attach non-identifying metadata to Kubernetes objects for tools, documentation, and human reference—use them for information that describes your resources without affecting how Kubernetes manages them.