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
withpatches
. - Move
apiVersion
,kind
, andmetadata.name
into atarget:
block. - Keep only the changed content (e.g.,
spec
,metadata
) insidepatch:
. - Maintain proper indentation and valid YAML syntax.
Updated about 11 hours ago