DEV Community

Cover image for Deploy Kubernetes add-ons in ClusterAPI powered cluster
Gianluca
Gianluca

Posted on • Updated on

Deploy Kubernetes add-ons in ClusterAPI powered cluster

As the demand for scalable and efficient Kubernetes infrastructure continues to grow, the ClusterAPI has emerged as a powerful solution for managing clusters. However, during my experience with the ClusterAPI while working on an internal project, I encountered a recurring challenge: the manual installation and upgrading of Kubernetes cluster add-ons for the numerous clusters created each day. Although options like Flux exist as viable solutions, I found the level of user interaction required to be less than ideal. I sought a more automated approach that could effortlessly identify clusters and comprehend their current state.

With this in mind, I embarked on the development of an open source project called Sveltos, available on GitHub. Sveltos aims to streamline the management of Kubernetes add-ons by enabling users to programmatically specify which add-ons (such as Helm charts, Customise or Kubernetes resources) should be deployed in specific clusters. Achieving this flexibility is made possible through the utilization of a ClusterSelector, which allows users to select clusters using labels that match a specified criteria.

projectsveltos ClusterProfile

Projectsveltos: Kubernetes add-on controller

Dry run

Having worked in the past in a different startup doing policy distribution in a distributed system, I know visibility is important. So sveltos provides user with DryRun mode as well where user can see the effect of a change before committing it
https://github.com/projectsveltos/sveltosctl#display-outcome-of-clusterprofiles-in-dryrun-mode

Cluster label management

In the pursuit of simplifying cluster management, a crucial aspect that needed attention was the burden placed on users to manually handle cluster labels. Recognizing the need for cluster labels to dynamically adjust in response to changes in cluster runtime state, I aimed to create a solution that would allow me to express my intentions and subsequently forget about the intricate label management process.

This led to the introduction of the Classifier CRD in Sveltos, a pivotal second concept that revolutionizes cluster classification.

Projectsveltos: cluster classification

This powerful feature empowers users to classify clusters based on their runtime state, currently including parameters such as the Kubernetes version and deployed resources, with ongoing efforts to expand its capabilities further.

With the Classifier CRD in place, I can effortlessly define my requirements, such as specifying that any cluster running Kubernetes version v1.25.2 necessitates a particular version of Calico as the Container Network Interface (CNI). As clusters undergo the upgrade process to reach Kubernetes version v1.25.2, the appropriate labels are automatically added to the clusters, enabling the seamless deployment of the correct Calico version.

This novel approach simplifies the management of cluster labels and ensures that the desired cluster runtime state is accurately reflected. By automating the label assignment process, Sveltos alleviates the manual burden on users and allows them to focus on higher-level tasks, confident that the cluster labels will adapt accordingly.

The accompanying GIF provides a succinct visual representation of this behavior, highlighting the seamless and intuitive nature of the Sveltos solution.

With the Classifier CRD and its dynamic label management capabilities, Sveltos takes cluster management to new heights, granting users the freedom to express their intentions effortlessly. By simplifying the process of cluster label management and leveraging automation to ensure accurate reflection of cluster runtime states, Sveltos empowers users to focus on more strategic aspects of their Kubernetes infrastructure management.

👏 Support this project

If you enjoyed this article, please check out the GitHub repo for the project. You can also star 🌟 the project if you found it helpful.

The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.

Thank you for reading!

Top comments (0)