liveBook · Manning

Imperative programming

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

An imperative approach prescribes the specific commands or sequence of actions needed to produce a result.

Imperative programming prescribes a specific sequence of commands or actions to produce a result. In Kubernetes, this means directing operations step by step rather than describing only the desired end state. section 1.0 section 1.9

An imperative workflow creates practical administration concerns:

  • Execution depends on command order, so changing the sequence can affect the result. section 1.9
  • Tracking the commands and detecting a failure during sequential execution can be difficult. section 1.9
  • Unlike declarative configuration, the approach focuses on the path of commands rather than only the target state. section 1.10 section 1.9

Sequential Kubernetes administration

An administrator using an imperative approach runs a series of commands in a specific sequence to reach a result. This can be contrasted with submitting a YAML manifest that describes the desired Kubernetes state. section 1.9

$ kubectl create -f my-pod-manifest.yaml 
pod/nginx created

The kubectl submission shows the contrasting declarative workflow: provide a manifest and let the Kubernetes API determine how to reach the described state. section 1.9

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Defines sequencing and names tracking, failure-detection, and ordering problems, but gives no detailed command sequence.
Examples
Uses sequential commands and contrasts them with a YAML manifest submitted through kubectl.
What you can do after
Evaluate/understand when sequential commands differ from describing a desired Kubernetes end state.
How it connects
Connects imperative programming to declarative configuration, YAML manifests, kubectl, and the Kubernetes API.

Also explained in

Compare how 14 books explain imperative programming →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.