Patch a live object
high risk
kubectl patch <res> -p '<patch>' --dry-run=server -o yamlPreview the resultStrategic-merge, merge or JSON patches. See the flags and examples below, and run `man kubectl` for the full reference.
| Flag | Meaning |
|---|---|
-p | Patch body |
--type --type | merge | json | strategic |
--dry-run=server --dry-run=server | Simulate |
kubectl patch deploy web -p '{"spec":{"replicas":3}}'Set replicas · explain & risk-check →Reference text is hand-written and may be incomplete — check man kubectl for your version. Test destructive commands on a non-production system first.