Keyboard shortcuts

/ or ⌘/Ctrl K
Find a note
j / k
Next / previous section or linked note
h / l
Collapse or go to parent / expand or enter
e or Alt-click
Read a linked note here
o
Open focused note on its own
g g / G
First / last section or linked note
g h / g a
Home / all notes
g b / g t
Backlinks / table of contents
t
Cycle System, Light, Dark
? / Esc
Show / close this reference

Search: ↑/↓ or Ctrl N/P, Enter to open. Shortcuts pause while typing.

programming kubernetes chapter 1 - intro [1939b0e5]

Tags: hausenblas - programming kubernetes

  • Building native apps that speak to both the kubelet and the API server
  • Extension points

    • cloud-controller-manager integrates w/ the cloud
    • kubelet binary lets network/devices/storage and container runtimes
    • kubectl has plugins
    • extensions on API server
    • custom resources and controllers
    • custom API servers
    • scheduler extensions

1. controllers (k8s) and Operators

  • Controllers implement a control loop, watching the shared state of the cluster through the API server and making changes in an attempt to move the current state towards the desired state

    • Controllers act on core resources
    • Operators are controllers that encode some operational knowledge
  • the controllers pull info, computes the difference between the desired state and the current state, and updates accordingly

1.1. The control loop

  • Read state (hopefully event driven)
  • Change state
  • Update status via API server in etcd
  • repeat

1.1.1. Data structures used by the controller

  • Informers

    • Obtains the state of a cluster, often with a resync mechanism
  • Work queues

    • used for event handler that handles the queuing of state changes

1.1.2. State transitions

  • k8s iteratively determines what is the next command to run, when no commands can be run, cluster is in steady state
  • Kubernetes objects

    • kube object store is a set of kube objects

      • kube objects are data records that come in kinds
  • controller transitions can cascade into one another, state transition from one controller can cause another to happen
  • therefore kube objects are records of intent, not records of fact
  • ultimately kube does not make coordinated efforts to transition into a desired state

1.1.3. Operators

Operators encode specific knowledge about the underlying resource, allowing it to manage specific state, shipping with custom resource definitions (crds) and custom controllers

For example, a Cassandra operator can balance nodes accordingly