Skip to content
Latchkey

kustomize "patchesStrategicMerge is deprecated" in CI

Newer kustomize deprecates the separate patchesStrategicMerge and patchesJson6902 fields in favor of a single patches field. Depending on version it prints a deprecation warning or, with strict checks, fails the build. The fix is to migrate to patches.

What this error means

kustomize build prints "# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead." or fails a lint gate that treats the deprecation as an error.

kustomize
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead.
Run 'kustomize edit fix' to update your Kustomization automatically.

Common causes

The kustomization uses a deprecated patch field

A legacy patchesStrategicMerge or patchesJson6902 block triggers the deprecation notice on newer kustomize.

A CI gate fails on deprecation output

A pipeline that greps for warnings or runs strict checks turns the deprecation into a build failure.

How to fix it

Migrate to the unified patches field

  1. Move each strategic-merge patch under patches: with a path:.
  2. Move JSON6902 patches under patches: with a target: selector.
  3. Run kustomize edit fix to migrate automatically, then review the diff.
kustomization.yaml
patches:
  - path: deployment-patch.yaml
  - path: replica-patch.yaml
    target:
      kind: Deployment
      name: api

Auto-migrate with kustomize edit fix

Let kustomize rewrite the deprecated fields, then commit the result.

Terminal
kustomize edit fix
git diff kustomization.yaml

How to prevent it

  • Prefer the unified patches field in new kustomizations.
  • Run kustomize edit fix when upgrading kustomize versions.
  • Pin the kustomize version in CI so behavior is consistent.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →