Kustomize Patch Migration Guide

ℹ️

Note: patchesStrategicMerge is deprecated in Kustomize v5+


This document helps you migrate to the modern patches format.

Original (Deprecated Style)

patchesStrategicMerge:
  - |
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: my-service-gv
      spec:
        template:
          metadata:
            annotations:
              prometheus.io/port: "8000"
              prometheus.io/scrape: "true"


Updated (Recommended Style)


patches:
  - target:
      group: apps
      version: v1
      kind: Deployment
      name: my-service-gv
    patch: |
      spec:
        template:
          metadata:
            annotations:
              prometheus.io/port: "8000"
              prometheus.io/scrape: "true"

🛠 Migration Steps

  • Replace patchesStrategicMerge with patches.
  • Move apiVersion, kind, and metadata.name into a target: block.
  • Keep only the changed content (e.g., spec, metadata) inside patch:.
  • Maintain proper indentation and valid YAML syntax.