100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Kustomize Cheat Sheet

Kustomize Cheat Sheet

Kustomize declarative Kubernetes config management covering overlays, patches, generators, and common CLI commands.

2 PagesIntermediateJan 22, 2026

Base kustomization.yaml

A minimal base referencing raw Kubernetes manifests.

yaml
apiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomizationresources:  - deployment.yaml  - service.yaml  - configmap.yamlcommonLabels:  app.kubernetes.io/name: checkoutimages:  - name: myapp    newTag: 1.4.2

Overlay with Patches

Environment-specific overlay that patches the base for production.

yaml
# overlays/prod/kustomization.yamlapiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomizationnamespace: prodresources:  - ../../basepatches:  - target:      kind: Deployment      name: checkout    patch: |-      - op: replace        path: /spec/replicas        value: 5configMapGenerator:  - name: checkout-config    behavior: merge    literals:      - LOG_LEVEL=warnreplicas:  - name: checkout    count: 5

CLI Commands

Building and applying kustomizations.

bash
# Render final manifests without applyingkustomize build overlays/prod# Apply directly via kubectl (native kustomize support)kubectl apply -k overlays/prod# Diff against the live clusterkubectl diff -k overlays/prod# Add a resource to a kustomizationkustomize edit add resource deployment.yaml# Set an image tag programmaticallykustomize edit set image myapp=myapp:1.5.0

Generators & Transformers

Built-in fields for generating and transforming resources.

  • configMapGenerator- generates a ConfigMap from literals or files, auto-appends a content hash suffix
  • secretGenerator- generates a Secret the same way; combine with SOPS/sealed-secrets for encryption at rest
  • namePrefix / nameSuffix- prepends/appends a string to all resource names in scope
  • commonAnnotations- applies annotations across every resource in the kustomization
  • patchesStrategicMerge (legacy) / patches- modern `patches` field supports both strategic-merge and JSON6902 patches
  • components- reusable, optional bundles of config that overlays can opt into
Pro Tip

Let configMapGenerator's auto-generated hash suffix do your rollout triggering for you — because the ConfigMap name changes whenever content changes, any Deployment referencing it gets a new pod template hash and rolls automatically, no manual `kubectl rollout restart` needed.

Was this cheat sheet helpful?

Explore Topics

#Kustomize#KustomizeCheatSheet#DevOps#Intermediate#BaseKustomizationYaml#OverlayWithPatches#CLICommands#GeneratorsTransformers#Kubernetes#CommandLine#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet