The design of the Machine Controller Manager is influenced by the Kube Controller Manager, where-in multiple sub-controllers are used to manage the Kubernetes clients.
It's designed to run in the master plane of a Kubernetes cluster. It follows the best principles and practices of writing controllers, including, but not limited to:
- Reusing code from kube-controller-manager
- leader election to allow HA deployments of the controller
workqueues
and multiple thread-workersSharedInformers
that limit to minimum network calls, de-serialization and provide helpful create/update/delete events for resources- rate-limiting to allow back-off in case of network outages and general instability of other cluster components
- sending events to respected resources for easy debugging and overview
- Prometheus metrics, health and (optional) profiling endpoints
Machine Controller Manager makes use of 4 CRD objects and 1 Kubernetes secret object to manage machines. They are as follows,
MachineClass
: Represents a template that contains cloud provider specific details used to create machines.Machine
: Represents a VM which is backed by the cloud provider.MachineSet
: Represents a group of machines managed by the Machine Controller Manager.MachineDeployment
: Represents a group of machine-sets managed by the Machine Controller Manager to allow updating machines.Secret
: Represents a Kubernetes secret that stores cloudconfig (initialization scripts used to create VMs) and cloud specific credentials
Machine Controller Manager is made up of 3 sub-controllers as of now. They are -
Machine
Controller: Used to create/update/delete machines. It is the only controller which actually talks to the cloud providers.MachineSet
Controller: Used to manageMachineSets
. This controller ensures that desired number of machines are always up and running healthy.MachineDeployment
Controller: Used to update machines from one version to another by manipulating theMachineSet
objects.- Machine Safety Controller: A safety net controller that terminates orphan VMs and freezes
MachineSet
/MachineDeployment
objects which are overshooting or timing out while trying to join nodes to the cluster.
All these controllers work in an co-operative manner. They form a parent-child relationship with MachineDeployment
Controller being the grandparent, MachineSet
Controller being the parent, and Machine
Controller being the child.