Kubernetes Controllers
It’s a straightforward reconciliation process that continuously monitors and takes action on standard Kubernetes resources, executing the following steps in a perpetual manner:
Observe: Monitor events emitted by Kubernetes to ascertain the current state of observed resources.
Analyze: Identify discrepancies between the current state and the desired state.
Act: Execute operations to align the current state with the desired state.
There are built-in controllers handle standard Kubernetes resources such as DaemonSets, ReplicaSets, Deployments, and Services. These controllers operate within the controller manager deployed on the Kubernetes control plane. They continuously execute a reconciliation loop to promptly respond to any state changes detected across the cluster.
For instance, the ReplicaSet controller monitors changes to ReplicaSet resources. It assesses the required number of Pods that should be running and responds by sending Pod specifications to the API Server. The Kubernetes backend subsequently initiates the requested Pods on the designated worker nodes.
Custom Controllers
Kubernetes’ event-driven architecture also supports the integration of custom controllers, enabling extension of the platform with bespoke functionalities.
Since Kubernetes is implemented in Go, and its comprehensive client library is also written in Go, including many controllers, it is indeed possible to develop controllers in any programming language by interacting with the Kubernetes API server through HTTP requests.
I’m intrigued! Writing a controller in pure shell script to extend Kubernetes’ resource management sounds like a fascinating challenge. If you have specific questions as you delve into this project, feel free to ask!