Chapter 15: Kubernetes Introduction
15.12b Declarative apply vs imperative run
Prefer declarative manifests in Git (kubectl apply -f) over long chains of one-off kubectl run / kubectl expose for anything you want to repeat. Imperative commands are fine for a 30-second experiment; capstone and teammates need files.
| Imperative experiment | Declarative habit |
|---|---|
| Fast curiosity | Reviewable in PR |
| Easy to forget flags | Diffable YAML |
| Hard to recreate next week | apply again from repo |