Apply a strategic/merge patch to an object.

Section: Declarative Apply, Edit, and Replace

Patch resource

bash
bash
kubectl patch deployment web -p '{"spec":{"replicas":5}}'
Explanation

Apply a strategic/merge patch to an object.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Declarative Apply, Edit, and Replace
Edit resource live
Open a live editor against the API server.
OpenIn sheetbashsame section
JSON patch resource
Apply an RFC 6902 JSON patch.
OpenIn sheetbashsame section
Apply manifest file
Create or update a resource from a file.
OpenIn sheetbashsame section
Apply all manifests in directory
Recursively apply manifests from a directory.
OpenIn sheetbashsame section
Apply recursively
Apply manifests recursively from nested directories.
OpenIn sheetbashsame section
Apply manifest from URL
Apply a manifest hosted remotely.
OpenIn sheetbashsame section