Annotations in Kubernetes: The Sticky Notes of Your Cluster
A beginner-friendly, ground-up guide to what annotations are, how they differ from labels, how tools read them, and how real teams use them safely without turning their cluster into a junk drawer.
Picture a large library. Every book has an official record: title, author, shelf number. Those details are how the librarians find and organise books. But over the years, people also stick little yellow notes on some books: “Donated by the mayor”, “Pages 40 to 60 are damaged”, “Ask Priya before lending this out”. None of those notes help the library sort its shelves, yet they carry useful knowledge for the people and tools that read them. Annotations are the yellow sticky notes of Kubernetes.
Almost everything you create in a cluster can carry annotations. They are quiet, flexible, and easy to underestimate. This guide starts from zero and walks through what annotations are, why Kubernetes needed them, how they differ from their famous cousin the label, how tools depend on them behind the scenes, and how to use them wisely.
1What Is Metadata, and Why Do We Need It?
Before we talk about annotations, we need to understand the bigger idea they belong to: metadata.
Data about data
Metadata simply means “information about something”. A photo on your phone is the main data. The date it was taken, the place, and the camera used are the metadata. You do not look at metadata to enjoy the photo, but it helps you find, sort and understand the photo later.
Kubernetes objects work the same way. A Deployment has its main content, which is what you want to run. Around it sits metadata: its name, the namespace it lives in, its labels and its annotations. Metadata is the description that wraps the object.
Think of a parcel in the post. The item inside is the main data. The address label, the “fragile” sticker and the handwritten “leave with neighbour” note are all metadata. Some stickers are used by the sorting machine, and some are only for the delivery person.
Two very different jobs for metadata
Metadata in Kubernetes does two different jobs. The first job is to identify and group objects, so that the system can select them. The second job is to attach extra information that helps people and tools, but which the system never uses to select anything. Labels do the first job. Annotations do the second.
If you remember only one sentence from this guide, make it this one: labels are for selecting, annotations are for describing.
2Kubernetes in Five Minutes
A quick tour of the building blocks that annotations get attached to.
Kubernetes is a system that runs and manages applications packed into small, portable boxes called containers. You describe what you want, and Kubernetes keeps making it true. If a program crashes, it is restarted. If demand grows, more copies can be started.
Cluster
The whole group of computers that Kubernetes manages together as one big system.
Node
One computer inside the cluster that actually runs containers.
Pod
The smallest runnable unit. It wraps one or more containers that work as a team.
Deployment
A manager object that keeps a chosen number of identical pods running and handles updates.
Service
A stable address that lets other programs reach a group of pods, even as those pods come and go.
Controller
A background program that watches objects and works to make reality match what you asked for.
Every one of these objects carries the same standard metadata section, and every one of them can carry annotations. That uniformity is one of the reasons annotations became so widely used: whatever you are working with, the same simple mechanism is available.
Picture a shopping mall again. The mall is the cluster, each shop is a node and each counter is a pod. Every item in the mall, from a counter to a signboard, has a small tag holder next to it. That tag holder is the metadata section, and annotations are the notes you can slip into it.
3What Is an Annotation?
A plain definition, followed by what makes annotations special.
The core idea
An annotation is a key and value pair of text attached to a Kubernetes object, used to store extra, non-identifying information. The key is a name, such as a note’s title. The value is the text of the note. Both are written as plain strings.
Annotations do not change how the object behaves on their own. Kubernetes does not use them to decide which pods belong to which service. Instead, they are a place to leave information for tools, for automation, and for humans who inspect the object later.
What makes annotations special
They Can Hold Almost Anything
Annotation values can be short or long, structured or free text. A value might be a phone number, a web link, a build number, a timestamp or even a small block of structured data written as text. This is far more freedom than labels allow.
They Are Not Used for Selection
You cannot ask Kubernetes to find “all objects with this annotation” as part of its own grouping machinery. Because annotations cannot be selected, they cannot accidentally change which pods a service or deployment controls.
They Are Meant for Readers
Readers can be a person running a command to inspect an object, an ingress controller working out how to configure a web server, or a monitoring tool deciding whether to collect metrics. Annotations are messages left for whoever needs them.
Labels are like the aisle signs in a supermarket, which the shop uses to organise everything. Annotations are like the small notes staff leave on a shelf: “Supplier changed this month” or “Check expiry weekly”. The shop’s layout does not depend on those notes, but staff find them very useful.
4Labels Versus Annotations
The most common beginner question is when to use which. This chapter settles it.
Labels and annotations sit side by side in the metadata section, and at first glance they look almost identical: both are key and value pairs. The difference is in purpose and in rules.
| Aspect | Labels | Annotations |
|---|---|---|
| Main purpose | Identify and group objects | Attach extra descriptive information |
| Used by Kubernetes to select objects | Yes, through selectors | No |
| Value length | Short, with a strict small limit | Long values allowed, within a large total limit |
| Allowed characters in values | Restricted set | Any text |
| Typical readers | Controllers, services, schedulers | Tools, operators, humans, external systems |
| Example content | App name, environment, tier | Owner contact, build details, tool settings |
| Effect of adding one | May change which objects are matched | Does not change grouping |
A simple test
Ask yourself: “Do I need Kubernetes to find or group objects using this piece of information?” If the answer is yes, it belongs in a label. If the answer is no, and it is just information for someone or something to read, it belongs in an annotation.
Beginners sometimes put long descriptions or contact details in labels because labels feel more official. Labels have tight size and character limits and are meant to be indexed and matched quickly, so stuffing them with notes causes errors and clutter. Put descriptions in annotations.
flowchart TD
Q["I have a piece of extra information"] --> D{"Should Kubernetes use it to select or group objects?"}
D -- "Yes" --> L["Use a label"]
D -- "No" --> A["Use an annotation"]
L --> R1["Short, simple, identifying value"]
A --> R2["Descriptive value for tools and people"]
5Anatomy of an Annotation
Every annotation has the same simple parts. Knowing them helps you avoid rejected requests and confusing clashes.
The key
The key has two possible parts separated by a slash. The first part is an optional prefix, and the second part is the name. When a prefix is present, it must look like a normal internet domain name, such as one belonging to a company. The name part is required and is limited to a short length, using letters, digits, dashes, underscores and dots.
The prefix exists to prevent collisions. If two different tools both want to use a key called “config”, they would trample each other. With prefixes, each tool uses its own domain as a namespace for its keys, so a monitoring tool and an ingress tool can both have their own “config” without confusion.
The value
The value is a text string. Kubernetes does not care what is inside it. If a tool wants to store structured information, it will usually write it as text in a format the tool understands and read it back later.
The size limit
There is a limit on the combined size of all annotations on a single object. The limit is roughly a quarter of a megabyte in total. This is generous, but not infinite. Every annotation is stored with the object, sent over the network and held in memory by controllers, so oversized notes make the whole cluster heavier.
Reserved prefixes
Prefixes ending in kubernetes.io and k8s.io are reserved for the core Kubernetes system. Ordinary users should not invent keys under those domains. Use your own company domain instead, so that your keys clearly show who owns them.
Consider an office where every department has its own coloured sticky notes. Red notes belong to finance, blue to engineering. Nobody mixes them up, because the colour tells you who wrote the note. A key prefix is the colour of the sticky note.
6Internal Working: How Annotations Travel
Let us follow an annotation from the moment it is written to the moment a tool acts on it.
Step one: the note is written
Someone creates or changes an object, and includes annotations in its metadata. The request goes to the API server, the front desk of the cluster. The API server checks who is asking, checks permissions, validates the format of the keys and the total size, and then stores the object in etcd, the cluster’s database.
Step two: watchers notice
Controllers and tools do not constantly ask “has anything changed?”. Instead, they subscribe to a stream of changes from the API server, known as a watch. When an object with annotations is created or updated, every interested watcher receives the news almost instantly.
Step three: the reader acts
Each watcher looks at the annotations it cares about and ignores the rest. An ingress controller reads its own prefixed annotations to decide how to configure a web server. A monitoring tool reads its own to decide whether to collect metrics. Nothing in Kubernetes itself forces these tools to obey; the agreement is a convention between whoever writes the note and whoever reads it.
sequenceDiagram
participant User as Engineer or Automation
participant API as API Server
participant DB as etcd
participant Tool as Controller or Tool
User->>API: Create or update object with annotations
API->>API: Check identity, permissions and format
API->>DB: Store object and annotations
API-->>Tool: Send change notification through watch
Tool->>Tool: Read only the annotations it understands
Tool->>API: Act, for example update status or related objects
Annotations work only because a tool is listening for them. Adding a note that no tool reads is harmless but useless. If an annotation seems to do nothing, first check that the right tool is installed and that you spelled the key exactly as it expects.
Annotations added by the system itself
Not all annotations are written by people. Kubernetes and its tools add many of their own. For example, when you apply a description with the standard command line tool, it stores a copy of what you last applied in an annotation, so that it can work out the difference next time. Deployments record their revision numbers in annotations too. If you inspect a real object, you will often find several notes you never wrote.
7Well-Known Annotations You Will Meet
A tour of the annotations that appear again and again in real clusters.
Last Applied Configuration
Added by the command line tool to remember what you last applied, so it can compute changes correctly on the next apply.
Deployment Revision
Records which revision number a deployment or its replica set represents, which powers rollbacks.
Change Cause
A human-written reason for a change, shown in rollout history so people know why a revision exists.
Restarted At
Added to the pod template when you ask for a rolling restart. The timestamp makes the template different, which triggers new pods.
Default Storage Class
Marks one storage class as the default, so claims that do not name a class receive it automatically.
Pod Deletion Cost
A hint that tells the system which pods are cheaper to remove first when reducing the number of replicas.
Ingress Controller Settings
Popular ingress controllers read prefixed annotations to tune timeouts, redirects, body sizes and security rules per route.
Cloud Load Balancer Options
Each cloud provider defines annotations on services to choose load balancer type, internal or public exposure and health checks.
Monitoring Hints
By common convention, notes on pods or services tell a metrics collector whether to scrape them, and on which port and path.
Autoscaler Eviction Hints
The cluster autoscaler reads an annotation to know whether a pod may safely be moved when it shrinks the cluster.
Sidecar Injection Switches
Service meshes use annotations to decide whether a pod should get their helper container automatically added.
GitOps Tracking
Delivery tools record which source and revision created an object, helping them detect drift.
Several of the ecosystem annotations, such as monitoring hints, are conventions followed by particular tools, not built-in Kubernetes features. They work only if the corresponding tool is installed and configured to honour them.
8The Pod Template Trap
One of the most surprising behaviours for beginners: where you put an annotation changes what happens.
A Deployment has two places where annotations can live. The first is on the Deployment itself, in its own metadata section. The second is inside the pod template, which is the blueprint used to stamp out each pod. These two places look similar, but they behave very differently.
Annotation on the Deployment
This is a note about the manager object. Changing it does not touch the running pods at all. Nothing restarts. It is ideal for notes about ownership, documentation links or tool settings that concern the deployment as a whole.
Annotation in the Pod Template
This is a note that will be copied onto every pod. Because the pod template defines what a pod should look like, changing anything inside it, including an annotation, counts as a change to the desired pod. Kubernetes responds by rolling out new pods with the new template.
flowchart LR
A["Edit annotation on Deployment metadata"] --> B["Deployment record changes"]
B --> C["No new pods created"]
D["Edit annotation in pod template"] --> E["Pod template changes"]
E --> F["New replica set created"]
F --> G["Rolling update replaces pods"]
A helpful trick built on this behaviour
The standard rolling restart command relies on exactly this. It adds a timestamp annotation to the pod template. Since the template is now different, Kubernetes replaces the pods one by one, giving you a graceful restart without changing any real setting.
Imagine a bakery with a recipe card. Writing a note on the shop’s noticeboard changes nothing in the oven. But writing a change on the recipe card itself means the next batch of loaves will be baked differently. The pod template is the recipe card.
Automation that stamps a changing value, such as the current time or a build number, into the pod template will cause a rollout every single time. Only put values in the template that you genuinely want to trigger a restart.
9The Life of an Annotation
Annotations are born, read, changed and eventually retired. Thinking about each stage keeps clusters tidy.
Decision
A team decides what information needs to travel with an object and who will read it. A clear reader and purpose come first.
Writing
The note is added when the object is created, either by a person, by a template or by automation such as a delivery pipeline.
Validation
The API server checks the key format and the total size. Some clusters add extra checks through admission policies.
Reading
Tools that watch the object notice the note and act on it, or humans inspect it while troubleshooting.
Update
As facts change, such as a new owner or a new setting, the note is edited. Stale notes are worse than none.
Retirement
When the tool or purpose disappears, the annotation is removed so that nobody is misled by old instructions.
Many teams manage the first three stages well and forget the last two. Over years, objects gather notes that nobody understands, and people become afraid to delete them.
10What Teams Actually Use Annotations For
Real-life use cases, grouped by purpose.
Configuring Ingress and Load Balancers
An ingress object describes which web addresses lead to which services. Fine settings, such as how long to wait for a slow response, whether to force secure connections, or how large an upload may be, do not fit into the standard fields. Controllers therefore read annotations for these per-route options.
Recording Ownership and Contacts
When something breaks at night, the first question is “who owns this?”. Annotations can hold the team name, a chat channel and an on-call contact right on the object, so that the answer is one inspection away.
Linking to Documentation
A link to the runbook, the design document or the dashboard can be stored as an annotation. Engineers looking at a strange object can jump straight to the explanation.
Tracking Builds and Releases
Delivery pipelines often stamp the build number, the source code revision and the time of release onto objects. When a problem appears, you can trace exactly which code is running.
Guiding Monitoring and Logging
Observability tools use annotations to decide which pods to scrape, which log format to expect and which alert group should be notified.
Controlling Automation Behaviour
Tools like autoscalers, service meshes and backup systems use annotations as on and off switches or hints, letting teams opt individual workloads in or out without editing the tool’s global settings.
Supporting GitOps and Drift Detection
Continuous delivery tools mark the objects they own, so that they can tell the difference between an object they created and one someone made by hand.
In a hospital, a patient’s wristband carries the main identity, but the chart at the end of the bed carries notes: allergies, the doctor in charge, the next check-up. Annotations are the chart. Many different staff read it for different reasons.
11Naming and Organising Your Own Annotations
A few simple conventions keep annotations understandable across teams and years.
Always use your own prefix
Choose a domain your organisation owns and use it as the prefix for every custom annotation. This shows at a glance who wrote the note, prevents clashes with tools, and makes it easy to find and clean up your own notes later.
Keep names meaningful
Pick names that say what the value is, such as the owning team or the runbook link, rather than vague names like “info” or “data”. A future reader should understand the purpose without asking the author.
Keep one fact per annotation
Resist the temptation to pack several facts into a single note. A single value holding a team name, phone number and chat channel is harder to read, harder to update and harder for tools to parse than three separate notes.
Write a small shared catalogue
Keep a short internal document listing every custom annotation key your organisation uses, what it means, who reads it and who owns it. Without such a list, annotations slowly turn into a mystery.
| Habit | Why it helps |
|---|---|
| Company-owned prefix | Prevents clashes and shows ownership |
| Descriptive names | Readers understand purpose without asking |
| One fact per note | Simple to read, update and process |
| Documented catalogue | Avoids mystery notes and duplicated keys |
| Regular clean-up | Removes stale notes that mislead people |
12Security Considerations
Annotations look harmless, but they can carry real risk if treated carelessly.
Never store secrets in annotations
Annotations are stored in plain text and are shown to anyone who can read the object, including in many dashboards, command outputs and logs. Passwords, keys and tokens must never be placed in them. Use proper Secret objects or an external secret manager instead.
Annotations can change tool behaviour
Because tools read annotations as instructions, whoever can edit annotations can influence those tools. Some ingress controllers allow annotations that inject raw configuration snippets into the web server. If a low-trust user can set those, they may be able to reach far beyond their own application. Clusters that host many teams often disable such powerful annotations or block them with policy.
Control who can edit metadata
Role-based access control decides who may update objects. Anyone with permission to update a Deployment or a Service can change its annotations. Grant edit rights carefully, and separate the right to view objects from the right to change them.
Use admission policies as guard rails
Policy engines can check every new or changed object and reject those that break your rules. They can require certain annotations, such as an owner, forbid dangerous ones, and check that values follow the expected format. This turns conventions into enforced rules.
flowchart TD
W["Someone writes an annotation"] --> R["Access control: is this person allowed to edit?"]
R --> P["Admission policy: is this key and value allowed?"]
P --> S["Object stored in the cluster"]
S --> T["Tool reads the annotation"]
T --> B["Tool behaviour changes"]
P -. "Rejected" .-> X["Request refused with an explanation"]
An annotation is an instruction to a tool. If untrusted people can write instructions to a powerful tool, then that tool’s power is effectively in their hands. Treat annotation edit rights as part of your security model.
13Monitoring, Auditing and Troubleshooting
Annotations help you observe your cluster, and your cluster needs observing to keep annotations healthy.
Using annotations to support observability
Well-chosen annotations make troubleshooting faster. An object that names its owner, links to its runbook and states its release version saves many minutes during an incident. Some teams also add annotations describing the last automated change and who or what made it.
Auditing changes
The cluster’s audit log records who changed which object and when. Since annotations can alter tool behaviour, changes to sensitive annotations should be watched. An unexpected edit to a security-related annotation on an ingress is worth an alert.
Troubleshooting annotation problems
Annotation Seems Ignored
Check the exact key spelling, including the prefix, and confirm that the tool expected to read it is installed and running.
Unexpected Restarts
Look for changing values placed inside the pod template. Even a timestamp will trigger a fresh rollout each time.
Request Rejected
The key may break format rules, or the total size of annotations may be too large. Policy engines may also reject forbidden keys.
Conflicting Behaviour
Two tools may be writing or reading the same key, or an old annotation from a previous tool may still be present.
When debugging, always inspect the live object as stored in the cluster, not only the file you applied. Tools and controllers may have added, changed or removed annotations after you applied it.
14Design Patterns and Anti-Patterns
Patterns are proven habits. Anti-patterns are popular mistakes that keep hurting teams.
Patterns worth adopting
Ownership Metadata Everywhere
Require every workload to carry an owner and a contact channel as annotations, and enforce it with policy. Incident response becomes faster and orphaned objects become rare.
Opt-In Switches for Automation
Let workloads opt in or out of platform features, such as backups or mesh injection, through simple annotations. Teams get control without needing to change platform settings.
Release Traceability
Have the delivery pipeline stamp the source revision and release identifier on each object. Anyone can trace running software back to its exact origin.
Policy-Backed Vocabulary
Define an approved list of annotation keys and let an admission policy reject unknown or dangerous ones. The vocabulary stays small, safe and understood.
Anti-patterns to avoid
Problem
Teams use annotations as a hidden database, storing large chunks of configuration, lists or whole documents in them.
Why It’s Harmful
Every annotation is stored, transmitted and cached with the object. Large notes slow down the API server and controllers, hit the size limit and are hard to validate, version or review.
Correct Approach
Store bulky data in a proper configuration object or an external system, and keep only a short reference or link in the annotation.
Problem
Passwords, tokens or connection strings are placed in annotations because it is quick and visible to the tool that needs them.
Why It’s Harmful
Annotations are plain text and appear in many outputs. Anyone who can read the object can read the secret, and it may spread into logs, dashboards and backups.
Correct Approach
Use Secret objects or an external secret manager, and reference them by name from the workload or tool configuration.
Problem
Automation writes a constantly changing value, such as the current time, into the pod template annotations.
Why It’s Harmful
Each change counts as a new pod template, so pods are restarted on every run. Users see needless downtime risk, and rollout history fills with meaningless revisions.
Correct Approach
Put changing values on the Deployment’s own metadata, or only in the template when a restart is truly desired.
Problem
Teams use annotations where labels are needed, then try to select or group objects by them.
Why It’s Harmful
Kubernetes cannot select objects by annotations. Custom scripts that scan every object become slow and fragile, and the grouping logic is invisible to the rest of the platform.
Correct Approach
Use labels for anything that must identify, group or select objects, and keep annotations for descriptive notes.
Problem
Custom annotations are invented without prefixes or documentation, using vague names like “info” or “config”.
Why It’s Harmful
Names clash with tools, nobody knows who owns the notes, and future engineers are afraid to delete anything.
Correct Approach
Use an owned domain prefix, descriptive names and a shared catalogue explaining each key.
15Advantages, Disadvantages and Trade-offs
An honest look at what annotations give you, and what they cost.
Advantages
- One uniform mechanism that works on every kind of object
- Flexible values that can hold links, timestamps and structured text
- Lets tools be configured per workload without changing core Kubernetes
- Does not affect object selection, so it is safe to add notes freely
- Travels with the object, so context is never separated from it
- Encourages an ecosystem of independent tools sharing one cluster
Disadvantages / Trade-offs
- Values are unchecked text, so typos silently fail
- No built-in schema, so meaning depends on each tool’s documentation
- Cannot be used to select or group objects
- Can become clutter and mystery over time without governance
- Powerful annotations can be a security risk if untrusted users write them
- Total size limit and cluster load rise if notes are oversized
The lesson is that annotations are best thought of as a lightweight extension point. They let the ecosystem grow quickly, at the price of discipline. Teams that add simple conventions, enforcement and clean-up enjoy the flexibility without the mess.
16Best Practices and Common Mistakes
A checklist of habits that separate tidy clusters from cluttered ones.
Best practices
- Use labels to select, annotations to describe — apply the simple test every time you add metadata.
- Prefix custom keys with your own domain — it prevents clashes and shows who owns each note.
- Keep values short and single-purpose — one fact per annotation is easier for humans and tools.
- Never store secrets — reference Secret objects or an external manager instead.
- Know where you place it — remember that annotations in a pod template can trigger a rollout, while those on the Deployment do not.
- Enforce with policy — require ownership annotations and block dangerous ones with admission rules.
- Document your vocabulary — keep a short catalogue of approved keys and their meanings.
- Clean up regularly — remove notes for tools or teams that no longer exist.
Common mistakes
Many annotations on a live object were added by tools, not by you. Do not delete unfamiliar ones blindly. First find out which tool owns them, since removing a system-managed note can confuse that tool.
Because the value is unchecked text, a single wrong character makes the tool ignore the note without any error. Copy keys directly from the tool’s documentation.
Some famous annotations are only conventions of specific tools. If the tool is not installed, the note does nothing.
Reapplying a description can remove annotations that a tool added after the last apply, or keep ones you meant to delete, depending on how the change is applied. Know how your delivery tool handles annotations added by others.
17Real-World Examples
How the ideas in this guide show up in everyday engineering.
An E-commerce Site Tuning Its Web Entry Point
An online shop uses annotations on its ingress object to allow larger image uploads on the product page route, while keeping the strict default limits on the checkout route. Each route gets its own tuning, all without editing the shared controller settings.
A Bank Enforcing Ownership
A bank requires every workload to carry team and on-call annotations. An admission policy refuses any object that lacks them. During incidents, responders know exactly whom to contact within seconds of opening the object.
A Media Company Managing Cloud Load Balancers
A media company exposes some services to the public internet and others only inside its private network. Annotations on each service tell the cloud provider which type of load balancer to create, keeping the choice next to the service it affects.
A Platform Team Managing Costs
A platform team uses annotations to mark batch jobs that may safely be moved when the autoscaler shrinks the cluster, and marks critical databases as never to be moved. This lets the cluster save money without risking important workloads.
A Start-up Adopting GitOps
A small start-up keeps its whole cluster description in a repository. Its delivery tool stamps each object with the source and revision, so the team can tell at a glance what was deployed by automation and what someone changed by hand.
18Frequently Asked Questions
Labels identify and group objects, and Kubernetes can select objects using them. Annotations carry extra descriptive information for tools and humans, and Kubernetes never uses them for selection.
Yes, values can be any text, within a total size limit of roughly a quarter of a megabyte for all annotations on one object. Keys must follow the naming rules, including an optional domain-style prefix.
Only when they are inside a pod template and change. That counts as a new pod definition and triggers a rollout. Annotations on the object’s own metadata do not restart pods, though a tool watching them may react in its own way.
You may, but so do Kubernetes itself, command line tools, delivery systems, controllers and service meshes. It is normal to find annotations on live objects that you never wrote.
The most common reasons are a misspelled key, the wrong object type, or the reading tool not being installed. Annotations work only when something is listening for them.
Kubernetes selectors do not support annotations. You can still list objects and filter the results with scripts or tools, but this is slower and is not how grouping should be done. Use labels for anything you need to select.
No. Annotations are plain text and visible to anyone who can read the object. Use Secret objects or an external secret manager for sensitive values.
Use a domain your organisation owns. Avoid the reserved prefixes belonging to the core Kubernetes project, since those are meant for the system itself.
No. They live in the metadata section, separate from the specification that describes the desired state. The exception is when they sit inside a pod template, where they become part of the pod’s blueprint.
Write a short catalogue of the keys your teams use, add a policy requiring an owner annotation, and remove notes that belong to tools you no longer run.
19Summary and Key Takeaways
Annotations are the flexible sticky notes of Kubernetes. They attach extra, non-identifying information to any object, in the form of simple text keys and values. Kubernetes does not use them to select or group objects, but a rich ecosystem of tools reads them to configure ingress, load balancers, monitoring, autoscaling, delivery and more. Their freedom is their strength and their weakness: without conventions, security awareness and clean-up, they become clutter or even a hidden route to change tool behaviour.
Treat every annotation as a promise between a writer and a reader. Name it clearly, keep it small, know who reads it, protect who can write it, and retire it when its purpose ends. Do that, and annotations become one of the most useful quiet features of your cluster.
Key Takeaways
- Labels select, annotations describe — use labels for grouping and identification, and annotations for extra information that tools and people read.
- Annotations are plain text with rules — keys have an optional domain prefix and a name, values are free text, and the total size per object is limited.
- Tools give annotations their power — an annotation does something only if a controller or tool is watching for that exact key.
- Placement matters — annotations in a pod template trigger a rollout when changed, while those on the Deployment itself do not.
- Never store secrets in them — annotations are visible to anyone who can read the object, so use Secrets or an external manager.
- Treat edit rights as security — powerful annotations can change tool behaviour, so restrict who can write them and enforce rules with admission policies.
- Govern and clean up — use your own prefix, keep a catalogue, require ownership notes and remove stale annotations regularly.