πŸ“šBook Signing at KubeCon EU 2026Meet us at Booking.com HQ (Mon 18:30-21:00) & vCluster booth #521 (Tue 24 Mar, 12:30-1:30pm) β€” free book giveaway!RSVP Booking.com Event
Configuration beginner ⏱ 15 minutes K8s 1.28+

Kubernetes Annotations Complete Guide

Use Kubernetes annotations for metadata, automation, and controller config. Common patterns for ingress annotations, Helm labels, and triggers.

By Luca Berton β€’ β€’ πŸ“– 5 min read

πŸ’‘ Quick Answer: Use Kubernetes annotations for metadata, automation, and controller config. Common patterns for ingress annotations, Helm labels, and triggers.

The Problem

This is one of the most searched Kubernetes topics. Having a comprehensive, well-structured guide helps both beginners and experienced users quickly find what they need.

The Solution

Add Annotations

apiVersion: v1
kind: Pod
metadata:
  name: web-app
  annotations:
    # Descriptive metadata
    description: "Main web application serving customer traffic"
    git-commit: "abc123def456"
    build-url: "https://ci.example.com/builds/123"
    
    # Controller configuration
    prometheus.io/scrape: "true"
    prometheus.io/port: "9090"
    prometheus.io/path: "/metrics"
    
    # Ingress annotations
    nginx.ingress.kubernetes.io/rate-limit: "100"
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
# Add annotation
kubectl annotate pod web-app owner="team-platform"

# Update
kubectl annotate pod web-app owner="team-frontend" --overwrite

# Remove
kubectl annotate pod web-app owner-

# View
kubectl get pod web-app -o jsonpath='{.metadata.annotations}'

Common Annotation Patterns

AnnotationPurpose
prometheus.io/scrape: "true"Enable Prometheus scraping
cert-manager.io/cluster-issuerAuto-TLS certificates
nginx.ingress.kubernetes.io/*NGINX ingress config
kubectl.kubernetes.io/last-applied-configurationApplied config tracking
kubernetes.io/change-causeRollout change reason
# Record change cause (shows in rollout history)
kubectl annotate deployment web-app kubernetes.io/change-cause="Updated to v2.1"
kubectl rollout history deployment web-app
# REVISION  CHANGE-CAUSE
# 1         Initial deployment
# 2         Updated to v2.1
graph TD
    A[Annotations] --> B[Descriptive: git-commit, owner, docs]
    A --> C[Controller config: prometheus, cert-manager]
    A --> D[Ingress: rate-limit, rewrite, TLS]
    A --> E[Automation: CI/CD metadata, change-cause]

Frequently Asked Questions

Annotations vs labels?

Labels are for identification and selection (Services use them to find pods). Annotations are for arbitrary metadata β€” they can store longer values and aren’t used by selectors.

Best Practices

  • Start simple β€” use the basic form first, add complexity as needed
  • Be consistent β€” follow naming conventions across your cluster
  • Document your choices β€” add annotations explaining why, not just what
  • Monitor and iterate β€” review configurations regularly

Key Takeaways

  • This is fundamental Kubernetes knowledge every engineer needs
  • Start with the simplest approach that solves your problem
  • Use kubectl explain and kubectl describe when unsure
  • Practice in a test cluster before applying to production
#annotations #metadata #ingress #automation #kubernetes
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Kubernetes Recipes book cover

Want More Kubernetes Recipes?

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens