عجفت الغور

programming kubernetes

Tags: kubernetes (k8s)

Chapter 1

  • 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

Controller 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 control loop

  • Read state (hopefully event driven)
  • Change state
  • Update status via API server in etcd
  • repeat
  • 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
  • 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