Kubernetes YAML Cheat Sheet/Add annotation from CLI

Write metadata without affecting selectors.

Section: Metadata, Labels, and Annotations

Add annotation from CLI

bash
bash
kubectl annotate deployment api owner=platform-team --overwrite

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Metadata, Labels, and Annotations
Labels and annotations example
Common metadata block for selectors and tooling.
OpenIn sheetyamlsame section
Get resources by label selector
Use labels to query related objects.
OpenIn sheetbashsame section
Add or update label from CLI
Patch a label onto a resource.
OpenIn sheetbashsame section
Explain a field path
Discover valid YAML fields from kubectl.
OpenIn sheetbash1 tag match
Apply YAML file
Create or update resources from a YAML file.
OpenIn sheetbash1 tag match
Apply YAML directory
Apply all manifests in a directory.
OpenIn sheetbash1 tag match