liveBook · Manning

Control loop

As explained in Google Anthos in Action

A control loop repeatedly compares a resource’s desired state with its current state and takes corrective action to reconcile them.

A control loop continually compares a resource’s declared desired state with its current state, then takes corrective action to reconcile differences. Kubernetes uses control loops to keep resources in the state specified by users. section 3.2.2 section 3.2.4

Kubernetes control loops operate through several responsibilities:

  • The controller manager runs separate logical controllers in one binary and continually checks the resources each controller manages. section 3.2.2
  • A ReplicaSet loop compares the available Pod count with the declared replica count, adding or deleting Pods as necessary. section 3.2.4
  • The cloud controller manager applies the same pattern to provider-specific resources such as nodes, routes, load balancers, network filtering, and IP addresses. section 3.2.2
  • Scheduling remains a separate responsibility: the scheduler selects a worker node, while unsatisfied resource requests or constraints cause scheduling failure. section 3.2.2

Maintaining three replicas

A deployment declares three Pod replicas. If one Pod is accidentally deleted, the control loop detects that only two are available and creates a replacement, restoring the declared count. section 3.2.4

Table 3.1 Bundled controllers and their roles (view table figure)

Controller

Description

Node

Maintains the status of all nodes

Replication

Maintains the number of pods for replication controllers

Endpoint

Maintains the mapping of pods to services, creating endpoints for services

Service accounts/token

Creates the initial default account and API tokens for namespaces

Use the controller-role table to connect reconciliation responsibilities with node status, Pod replication, service endpoints, and service accounts. section 3.2.2

How Google Anthos in Action covers it

How deep it goes
Details continuous comparison, corrective actions, controller responsibilities, and scheduling boundaries without descending into controller implementation code.
Examples
Uses a deleted Pod restored to a three-replica deployment and tables of bundled and cloud controller responsibilities.
What it assumes
Assumes Kubernetes resource and deployment concepts while establishing control loops before contrasting declarative and imperative management.
What you can do after
Operate Kubernetes deployments by reasoning about desired state, reconciliation, replica recovery, and scheduling failures.
How it connects
Connects control loops with desired state, Kubernetes controller manager, ReplicaSet, scheduler, declarative model, and cloud controller manager.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Google Anthos in Action. The section links point to the parts of the book it draws on.