Ambassador Labs

Code, ship, and run apps for Kubernetes faster and easier than ever — powered by Ambassador’s…

Follow publication

GETTING EDGY VIDEO SERIES

Getting Edgy: Declarative vs Imperative

Stephanie Coyle
Ambassador Labs
Published in
2 min readDec 9, 2019

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

Subscribe to the Ambassador YouTube Channel to get updates about new weekly videos!

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in Ambassador Labs

Code, ship, and run apps for Kubernetes faster and easier than ever — powered by Ambassador’s industry-leading developer experience.

Written by Stephanie Coyle

Technical writer from Boston, MA with a love of solving big, complicated problems.

No responses yet

What are your thoughts?