preface

  • The declarative apis of K8S are mainly implemented in Reconcile cycles of various controllers
  • Tune the loop to get the current and user-expected state of the cluster
  • By adjusting the actual state, the desired state is constantly approached
  • This article is based on the Kubernetes controller evolution journey: from resource control to open application model
  • Because the text is easy to understand, after reading deeply inspired, the text content is displayed in the form of pictures

Phase 1: The controller accesses the API-server directly

  • Too many requests cause the apI-server to be overloaded

Phase 2: The controller accesses the API-server through the Informer

  • Informer provides List And Watch mechanism, incremental request API-server
  • When wath, only watch specific resources

Phase 3: Multiple controllers share informer to access apI-server

  • Resource objects managed by multiple controllers share Informer to further improve efficiency. For example, Deployment and DaemonSet both controllers manage POD resources
  • The DeltaFIFO queue is used to handle event notifications and update the local cache
  • WorkQueue Queues are used to notify each controller to process events

Stage 4: Customize controller + customize resource access API-server

  • CRD and CRD Controller are used to customize business logic
  • The Operator mode provides a simple programming framework for quickly implementing custom controllers
  • The commonly used operator frameworks are:
    • kubebuilder
    • operator-sdk

Stage 5: Open Application Model(OAM)

  • OAM is a set of specifications led by Ali and Microsoft
  • The purpose is to decouple the responsibilities of development, operation and maintenance, and each performs its own duties