Kubernetes

kubectl patch

CautionPatch resources

kubectl patch <kind>/<name> -p '<json>'

Applies partial updates from the CLI — scriptable fixes and annotation tweaks.

Examples

  • kubectl patch deploy web -p '{"spec":{"replicas":3}}'Patch just replicas

Syntax

kubectl patch <res> -p 'patch' [--type merge|json]

Before you run it

Prefer fixing manifests and re-applying.

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store