Home

patchesJson6902

PatchesJson6902 is a mechanism used by Kustomize to apply JSON Patch operations (RFC 6902) to selected Kubernetes resources during customization. It enables precise modifications of individual fields and is an alternative to patchesStrategicMerge when fine-grained changes are required. It is processed during the build of a kustomization and results in a patched set of resources.

Structure: In a kustomization.yaml, patchesJson6902 is a list. Each item defines targets and a patch. The targets

Example:

patchesJson6902:

- targets:

group: apps

version: v1

kind: Deployment

name: nginx-deployment

namespace: default

patch: |-

- op: replace

path: /spec/replicas

value: 3

Behavior and considerations: JSON Patch operations can add, replace, remove, move, copy, or test values. It

See also: The mechanism is based on RFC 6902 and is part of Kustomize’s patching capabilities for

block
identifies
the
intended
resources
by
group,
version,
kind,
name,
and
optional
namespace.
The
patch
is
a
YAML
block
that
encodes
a
JSON
Patch
array,
with
operations
such
as
op,
path,
and
value.
Paths
follow
JSON
Pointer
syntax
relative
to
the
resource
JSON.
can
patch
multiple
resources
by
providing
multiple
entries.
It
is
supported
by
Kustomize
builds;
compatibility
with
older
tooling
should
be
verified.
Correct
usage
depends
on
accurate
target
selectors
and
valid
JSON
Pointer
paths;
errors
in
paths
or
mismatched
resource
structures
can
cause
patch
failures.
It
is
particularly
useful
for
small,
nested
changes
where
a
full
merge
is
unnecessary.
Kubernetes
manifests.