Kubernetes YAML Kustomize and CRDs/Patch replicas via overlay

Set environment-specific replica count.

Section: Patches and Generators

Patch replicas via overlay

yaml
yaml
patches:
  - target:
      kind: Deployment
      name: api
    patch: |
      - op: replace
        path: /spec/replicas
        value: 5

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 Patches and Generators
Generate ConfigMap from literals
Create config objects as part of the build.
OpenIn sheetyamlsame section
Generate Secret from literals
Generate a Secret from string values.
OpenIn sheetyamlsame section
Minimal kustomization.yaml
List resource YAML files managed together.
OpenIn sheetyaml1 tag match
Apply a kustomization directory
Use kubectl's built-in Kustomize support.
OpenIn sheetbash1 tag match
Render kustomization output
See final YAML before applying.
OpenIn sheetbash1 tag match
Set namespace and common labels
Apply shared metadata to all resources.
OpenIn sheetyaml1 tag match