kubectl patch
The kubectl command that changes selected fields of a live Kubernetes object.
In more detail
A merge patch sends only the fields to change, as JSON or YAML. It is useful for small, urgent edits such as switching a Service selector during a rollback.
Example
kubectl patch service checkout --type merge -p '{"spec":{"selector":{"color":"blue"}}}'Related terms
- kubectl — The command-line tool for talking to a Kubernetes cluster's API server: creating, reading, changing and deleting objects.
- blue-green deployment — Running two complete environments, blue for the current release and green for the candidate, and switching traffic between them in one step.
- label selector — A query that picks objects by their labels, such as every pod with app=web; controllers and Services depend on it.
Taught in
- Rolling Back Blue-Green — Continuous Integration & Continuous Delivery Pipelines