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,
- Machine-class: Represents a template that contains cloud provider specific details used to create machines.
- Machine: Represents a VM which is backed by the cloud provider.
- Machine-set: Represents a group of machines managed by the Machine Controller Manager.
- Machine-deployment: 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.
- Machine Set Controller: Used to manage machine-sets. This controller makes sure that desired number of machines are always up and running healthy.
- Machine Deployment Controller: Used to update machines from one version to another by manipulating the machine-set 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 Machine Deployment Controller being the grandparent, Machine Set Controller being the parent, and Machine Controller being the child.
The following is a short list of future plans,
- Integrate the cluster-autoscaler to act upon machine-deployment objects, used to manage the required number of machines based on the load of the cluster.
- Support other cloud providers like OpenStack.
- Integrate a garbage collector to terminate any orphan VMs.
- Build a comprehensive testing framework.
- Fix bugs that exist in the current implementation.
This link contains the working doc for the todos which are planned in the near future.