Skip to main content
>_ supraj.dev
TOPIC DEVOPS
Declarative vs Imperative describing vs commanding
IN 10 SECONDS

Declarative states WHAT the infrastructure should look like (e.g. Kubernetes, Terraform), while Imperative states HOW to build it using a series of steps (e.g. bash scripts, CLI commands).

GOTCHA Imperative configurations are hard to scale because running the command sequence twice can produce errors if resources already exist.
HOW RECONCILIATION FLOWS
01 Declarative spec user specifies: 'I want 3 replicas' in a config file.
02 Reconciliation Engine system constantly checks the live state and corrects deviations automatically.
03 Imperative script runs command: 'launch server' then 'install packages'.
04 Errors handle imperative fails if a step breaks halfway; declarative recovers automatically.
POKE IT YOURSELF
kubectl apply -f deployment.yaml — declaratively apply a configuration state
kubectl create deployment my-app --replicas=3 — imperatively command pod creation