Advertisement
Beginner ArgoCD, GitOps Principles

What is declarative vs imperative configuration?

Short answer

Declarative configuration states the desired end state ('there should be 3 replicas') and lets the system converge to it; imperative issues step-by-step commands ('scale to 3 now').

Save ArgoCD mock interview
Advertisement
AModel answer
Declarative configuration states the desired end state ('there should be 3 replicas') and lets the system converge to it; imperative issues step-by-step commands ('scale to 3 now'). GitOps is declarative: you commit the desired state and the agent makes it so, which is idempotent, reproducible, and self-correcting versus one-off imperative commands.
# Declarative desired state
spec:
  replicas: 3
# vs imperative: kubectl scale deploy/app --replicas=3
Real-world example
The repo declares 3 replicas; whether the cluster had 1 or 5, ArgoCD converges it to 3.
Likely follow-ups
  • Why is declarative idempotent? | How does this enable self-healing?
Related topics