Module 12 · From Scratch · Kubernetes · with code: Go · about 19 min to read
Continue where you left off ×
Kubernetes 01: Imperative to Declarative
Imperative to Declarative · Open board
Sits under the project lesson, Build Your Own Kubernetes, From Scratch , and is the inversion the rest of this series builds on top of. Hands off to Kubernetes 02: The Reconcile Loop , which turns the inversion into a mechanism.
Before you start. This series builds a small copy of Kubernetes, a program that keeps a fleet of machines running the programs you asked for and restarts them when they die. The project lesson picked that target and named its six pieces. Nothing is built yet, so this lesson starts at the one choice that decides how every piece after it behaves.
The idea in 30 seconds
A script is a list of steps that runs once and ends. A fact is a description of what should be true, checked and re-checked forever.
The step version is imperative. The fact version is declarative, and Kubernetes is built entirely on facts.
A script’s failure is silent: it succeeds, exits, and the drift that follows belongs to nobody.
Asking for the same fact twice is safe: that’s idempotent, because a fact says what should be true, not what to change.
Applying a fact is a merge onto everything else on the object. The annotation remembering your last ask is what tells a real removal from a field that was never yours.
Read the story
Lesson 86 of 117 in From Scratch
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson 1993: fifty servers, and a physicist done writing scripts The swap: not steps, but a fact Three pods start, the script exits, and one crashes The GPS that never finishes Ask twice, get the same answer The one thing nobody mentions: a fact still has to be merged in Terms it explains: imperative, declarative, pod, it finishes, idempotent, merge, annotation, number, server-side apply.
Review From Scratch
Mark as read Saved in this browser, and to your account when you sign in.