Interview Prep/Kubernetes/Rapid-Fire Commands

How do you patch a resource quickly and what are the patch types?

IntermediateProductionRapid-Fire Commands
Answer
kubectl patch deploy web -p '{"spec":{"replicas":4}}'                          # strategic merge
kubectl patch deploy web --type=json -p='[{"op":"replace","path":"/spec/replicas","value":4}]'
kubectl patch deploy web --type=merge -p '{"spec":{"paused":true}}'

Strategic merge is default for built-ins; CRDs only support json and merge.

All Kubernetes questions

More on Rapid-Fire Commands