Developing Cloud Controller Manager
Kubernetes v1.11
beta
In upcoming releases, Cloud Controller Manager will be the preferred way to integrate Kubernetes with any cloud. This will ensure cloud providers can develop their features independently from the core Kubernetes release cycles.
Kubernetes 1.8
alpha
Before going into how to build your own cloud controller manager, some background on how it works under the hood is helpful. The cloud controller manager is code from kube-controller-manager
utilizing Go interfaces to allow implementations from any cloud to be plugged in. Most of the scaffolding and generic controller implementations will be in core, but it will always exec out to the cloud interfaces it is provided, so long as the cloud provider interface is satisfied.
To dive a little deeper into implementation details, all cloud controller managers will import packages from Kubernetes core, the only difference being each project will register their own cloud providers by calling cloudprovider.RegisterCloudProvider where a global variable of available cloud providers is updated.
Developing
Out of Tree
To build an out-of-tree cloud-controller-manager for your cloud, follow these steps:
- Create a go package with an implementation that satisfies cloudprovider.Interface.
- Use main.go in cloud-controller-manager from Kubernetes core as a template for your main.go. As mentioned above, the only difference should be the cloud package that will be imported.
- Import your cloud package in
main.go
, ensure your package has aninit
block to run cloudprovider.RegisterCloudProvider.
Using existing out-of-tree cloud providers as an example may be helpful. You can find the list here.
In Tree
For in-tree cloud providers, you can run the in-tree cloud controller manager as a Daemonset in your cluster. See the running cloud controller manager docs for more details.
Feedback
Was this page helpful?
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on Stack Overflow. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.