In this lesson, we’ll explore Kustomize’s built-in Common Transformers. They let you apply shared modifications—such as labels, prefixes/suffixes, namespaces, and annotations—to all of your Kubernetes manifests without touching each file manually.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
The Challenge
Imagine you have these two resource definitions:- Add a shared label:
org: KodeKloud - Append
-devto every resource name
Common Transformers Overview

| Transformer | Field Name | Purpose |
|---|---|---|
| Common Labels | commonLabels | Add one or more labels to all resources |
| Name Prefix/Suffix | namePrefixnameSuffix | Prepend or append text to resource names |
| Namespace | namespace | Assign a namespace to every resource |
| Common Annotations | commonAnnotations | Add one or more annotations to all resources |
1. Apply Common Labels
Add thecommonLabels block to your kustomization.yaml:
When you run
kustomize build, these labels will be merged into every resource’s metadata.labels.2. Set a Namespace
To place all resources into a specific namespace:3. Add Name Prefix & Suffix
Prepend and append text to every resource name:Choosing very long prefixes or suffixes can push resource names over Kubernetes’ max-length limit (63 characters). Always verify final name lengths.
4. Inject Common Annotations
Include the following to add annotations across all manifests:By combining these four settings in a single
kustomization.yaml, you can transform your base manifests consistently and safely—no manual edits required.
Links and References
- Kustomize Official Documentation
- Kubernetes Resource Configuration
- Managing Kubernetes with Kustomize