Apply, drift and three patch types
- 12 min
- 7 steps
- The API and the loop
Steps
0 of 7 done
Create a Deployment declaratively, drift it by hand, preview and undo the drift with apply, patch it three ways, and watch the three-way merge decide which changes survive.
Step 1 of 7
web.yamlin the current directory describes a three-replica Deployment. Create it declaratively, so that later applies can merge against it.Checked against the cluster as it changes.
Step 2, not started: Play the on-call engineer: change
webto 5 replicas with an imperative command, without touchingweb.yaml.Step 3, not started: Before applying again, preview what
web.yamlwould change on the live Deployment, and find the replica count in the output.Step 4, not started: Bring
webback to what the file says.Step 5, not started: Change the container image to
nginx:1.31with a JSON patch (--type=json) that replaces only that one field.Step 6, not started: Add the environment variable
LOG_LEVEL=debugto the container namedwebwith a patch that names the container but does not restate its image.Step 7, not started: Apply
web.yamlonce more. The image goes back tonginx:1.30, butLOG_LEVELstays. Confirm both on the live Deployment, and work out from the three-way merge rules why only one of your patches was undone.
Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.