Yesterday, patching k8s resource via patchesStrategicMerge is deprecated. In the example below, it uses patches. The only thing that changed here is the kustomization.yaml where patches is defined. The output is the same where image is patched.
kustomize build test/
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: po
name: po
spec:
containers:
- args:
- test
image: nginx:1.25
name: po
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
directory tree:
├── test
│ ├── base
│ │ └── po.yaml
│ ├── kustomization.yaml
│ └── patch
│ └── po-patch.yaml
po.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: po
name: po
spec:
containers:
- args:
- test
image: nginx
name: po
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
po-patch.yaml
apiVersion: v1
kind: Pod
metadata:
name: po
spec:
containers:
- name: po
image: nginx:1.25
kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./base/po.yaml
patches:
- path: ./patch/po-patch.yaml