GETTING EDGY VIDEO SERIES
Getting Edgy: Declarative vs Imperative
Learn the difference between declarative and imperative configuration when it comes to application architecture.

When you think about cluster and application management, there are two paradigms that you probably have heard of: declarative and imperative configuration.
Imperative
Think about imperative configuration like a remote control for a television. You use the buttons on it to change things until it’s how you want it to be. Make the sound louder, change the channel, turn on recording, etc.
Simply put, imperative is the “how” of configuration paradigms. In an edge API Gateway, you can go to an interface or a REST API to specifically enter the timeout for routing rules. First, it’s 8 seconds. Then later on, you change it to 5 seconds. You embed how you want it to work into the control flow of your API or the program calling it.
Declarative
In our analogy, the declarative model is like a thermostat. You know that you’ll be cold until it’s 70F so you set the temperature to 70F and you go about your day. The thermostat detects its environment and controls the temperature accordingly.
Declarative is expressing intent of “how” you want your system to work. This model uses a GitOps style approach, because you can write down in your source file that the timeout is 10 seconds and that is committed to source control. Your continuous integration system reads that source file and deploys it to your Kubernetes cluster. So, Git becomes your source of truth.
GitOps
GitOps is easy to automate; every change is managed in source control. It provides visibility as it shows you what should be in your cluster, and most importantly, captures the intent of your setup.
Imperative configurations do not necessarily convey their intent, because they focus on how your configuration works, not why, and therefore does not capture what you meant. Therefore, Kubernetes is ultimately a declarative style of GitOps configuration.
Learn More
- Declarative Management of Kubernetes Objects Using Configuration Files
- In Container Land, Declarative Configuration is King
- Declarative vs. Imperative paradigms
- Imperative vs. Declarative Kubernetes Management: A DigitalOcean Comic
Subscribe to the Ambassador YouTube Channel to get updates about new weekly videos!