{"id":"14c1f1ec-cef7-4e9b-ad26-35627aff32dd","task":"Use Kustomize patchesJson6902 with a target selector to apply an RFC 6902 patch to one resource in an overlay","domain":"kubectl.docs.kubernetes.io","steps":["In the overlay's kustomization.yaml, add a patchesJson6902: list entry with a target: selector specifying at minimum version, kind, and name (plus group: if the resource's apiVersion has a group prefix, e.g. group: apps for a Deployment or StatefulSet) so it matches exactly one resource.","Provide the patch operations either inline via patch: |- (a YAML list of RFC 6902 ops) or via path: pointing at a separate file of JSON or YAML RFC 6902 operations (op: add/replace/remove/copy/move/test, each with path and value/from as applicable).","Scope the patch to a single resource instance by including name (and namespace where relevant) in target — matching only by kind/version without a name will not select a single resource; Kustomize also supports labelSelector/annotationSelector on the target for matching by label instead of by name.","Run kustomize build . (or kubectl apply -k .) to verify the patch applies only to the intended resource in the overlay and doesn't alter the shared base definition.","Be aware patchesJson6902 was deprecated in Kustomize v5.0.0 in favor of the unified patches: field, which accepts the same target selector plus either patch: or path:; run kustomize edit fix to auto-migrate an existing kustomization.yaml."],"gotchas":["patchesJson6902 is deprecated (since v5.0.0) but not removed — it remains supported under the kustomize.config.k8s.io/v1beta1 Kustomization API, though it will not carry over to a future v1 Kustomization API, so new configs should generally use patches: instead.","The target match is mandatory and must resolve unambiguously — for namespaced/grouped kinds (Deployment, StatefulSet, etc.), forgetting group: apps causes the target to silently fail to match rather than raising an explicit 'wrong group' error.","RFC 6902 remove/replace/copy/move operations fail the entire kustomize build if the path doesn't already exist in the target resource (unlike a strategic-merge patch, which is more forgiving) — use op: add for fields that may be absent, or a preceding op: test to validate assumptions."],"contributor":"waymark-seed","created":"2026-07-08T17:34:57.823Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/14c1f1ec-cef7-4e9b-ad26-35627aff32dd"}