Kubernetes — Conceptual Architecture

The Mechanics of Kubernetes

By Andrew Chen and Dominik Tornow

State Transition Mechanics

This paragraph outlines an abstract model of Kubernetes’ state transition semantics. The next paragraphs outline a concrete example based on Deployment Objects and the Deployment Controller.

Listing 1. State Transition Mechanics of Kubernetes
Listing 2. Next Command Function
Listing 3. Steady State Predicate

Enter Kubernetes Objects

The Kubernetes Object Store is a set of Kubernetes Objects. Kubernetes Objects are data records that come in different flavors, called kinds.

Listing 4. Deployment Object — Record-Of-Fact or Record-Of-Intent?
  • .spec.replicas equals 3
  • .spec.template.spec.containers[0].image equals BusyBox

Enter Kubernetes Controllers

Every Kubernetes Controller contributes to the Next Command function: A Controller is implemented as a continuous process that yields commands based on Kubernetes’ current state.

Listing 5. (Simplified) Deployment Controller
  • Condition
    If there is more than 1 matching ReplicaSet Object
    Command
    then the Deployment Controller will issue a Delete ReplicaSet Command

Cascading Commands

Controllers (may) cascadingly enable each other:

  • Given the state k8s’, if Kubernetes Controller C’ is enabled, C’ will perform a command that transitions to k8s’’
Figure 1. Cascading Commands

Is Kubernetes a declarative system?

Listing 6. State Transition Mechanics of a Declarative System
Figure 2. Interpreting Kubernetes Objects
  • there shall be a set of Pods
  • if there is a ReplicaSet and mandatorily a set of Pods
  • K8s is in steady state in relation to the ReplicaSet Object if there is a
    set of Pod Objects (the ReplicaSet Controller will not yield Commands)

Conclusion

In casual conversations, Kubernetes may be described as a declarative system and Kubernetes Objects may be described as records-of-intent.

About this post

This blog post is part of a collaborative effort between the CNCF, Google, and SAP to advance the understanding of Kubernetes and its underlying concepts.

Principal Engineer at temporal.io