patchesStrategicMerge

Patch resources using the strategic merge patch standard.

Each entry in this list should be either a relative file path or an inline content resolving to a partial or complete resource definition.

The names in these (possibly partial) resource files must match names already loaded via the resources field. These entries are used to patch (modify) the known resources.

Small patches that do one thing are best, e.g. modify a memory request/limit, change an env var in a ConfigMap, etc. Small patches are easy to review and easy to mix together in overlays.

  1. apiVersion: kustomize.config.k8s.io/v1beta1
  2. kind: Kustomization
  3. patchesStrategicMerge:
  4. - service_port_8888.yaml
  5. - deployment_increase_replicas.yaml
  6. - deployment_increase_memory.yaml

The patch content can be a inline string as well.

  1. apiVersion: kustomize.config.k8s.io/v1beta1
  2. kind: Kustomization
  3. patchesStrategicMerge:
  4. - |-
  5. apiVersion: apps/v1
  6. kind: Deployment
  7. metadata:
  8. name: nginx
  9. spec:
  10. template:
  11. spec:
  12. containers:
  13. - name: nginx
  14. image: nignx:latest

Note that kustomize does not support more than one patch for the same object that contain a delete directive. To remove several fields / slice elements from an object create a single patch that performs all the needed deletions.