Are you currently managing Kubernetes clusters in the cloud and considering a transition to on-premises infrastructure using Cloudstack? This session is an exciting demonstration of how you can deploy Kubernetes clusters in a declarative manner, leveraging the capabilities of Cloudstack and Cluster API. In this demo, Ozhan showcases a comprehensive solution that combines Packer, Gitlab CI, ArgoCD, Cluster API, and Cluster Autoscaler to create a seamless on-premises deployment strategy adaptable to diverse requirements over Cloudstack Infrastructure.
-----------------------------------------
The CloudStack Collaboration Conference 2023 took place on 23-24th November. The conference, arranged by a group of volunteers from the Apache CloudStack Community, took place in the voco hotel, in Porte de Clichy, Paris. It hosted over 350 attendees, with 47 speakers holding technical talks, user stories, new features and integrations presentations and more.
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - Ozhan Karaman - Zebra Stack
1. Declarative Kubernetes
Cluster Deployment Using
Cloudstack and Cluster API
Ozhan Karaman
Zebra Stack Ltd.
ozhan zebrastack.co.uk
https://www.linkedin.com/in/ozhan-karaman/
2. Who am I?
● Working with Linux and Open Source platforms since 1998
● Open Source lover
● Started with Slackware and vi
● Using Cloudstack since 2015
● Working with Kubernetes since 2018
● Long technical journey with lots of adventures
3. What is Declarative Gitops Approach?
Declarative GitOps is an approach for managing
infrastructure and applications where the desired state of the
system is declared and stored in a Git repository.
Changes to the system are made by updating the Git
repository, and a GitOps tool automatically applies those
changes to the actual infrastructure, ensuring continuous
deployment, version control, and easy collaboration.
Declarative approaches, such as those used in tools like
Kubernetes, are often favored for their simplicity, ease of
automation, and improved maintainability. They allow users
to describe the desired state, and the system itself takes care
of achieving and maintaining that state. Imperative
approaches are more explicit, providing detailed instructions
on how to perform actions, which may be useful in certain
scenarios where fine-grained control is necessary.
4. ClusterAPI onPremise Infrastructure Providers
Vmware/Vsphere:
You need a minimum vCenter enabled cluster, Vmware’s Kubernetes offering heavily depends on
Clusterapi
Openstack:
You need to have an Openstack deployment(neutron, nova etc), there is no simple deployment to
test Clusterapi. Openstack developers are using devstack to develop & test their code.
Sidero Labs, Talos Linux:
They are providing their own tailored Linux OS, no ubuntu, debian there.
Cloudstack:
Standard Cloudstack deployment with KVM hypervisor is more then enough. Clusterapi Cloudstack
group is an active open source group.
5. Cluster API Common Concepts
Infrastructure provider:
A component responsible for the managing
infrastructure resources (VMs, networks, storage)
for CAPI.
Bootstrap provider:
A component responsible for turning a server into a
Kubernetes node, handles tasks like OS component
installation and network configuration, ensuring
consistent node preparation. (Cloud-init)
Control Plane provider:
Orchestrates creation, scaling, and lifecycle of
control plane components in CAPI. Deploys and
configures API server, controller manager, and
scheduler, ensuring proper control plane operation.
6. How Cluster API Works?
Declarative Cluster Definition:
Users define the desired state of their Kubernetes cluster using a set of declarative YAML manifests. These manifests typically
include specifications for the control plane and worker nodes.
Cluster API Controllers:
Cluster API introduces a set of custom controllers that run within the Kubernetes cluster. These controllers watch for changes
to the declarative cluster definitions.
Generation of Cloud-Init Scripts:
When a user submits a cluster definition, the Cluster API controllers interpret the specifications and generate cloud-init
scripts. Cloud-init is a popular way to bootstrap cloud instances with configuration data.
Infrastructure Provider Integration:
The generated cloud-init scripts are then used to initialize the virtual machines or instances on the chosen infrastructure
provider (e.g., Cloudstack, AWS, Azure, vSphere). Cluster API provides a pluggable infrastructure provider model, allowing
support for various cloud and on-premises environments.
7. How Cluster API Works?
Spinning up Servers:
The infrastructure provider provisions the necessary resources (VMs, instances) based on the cloud-init scripts. This step
results in the creation of the control plane nodes (master nodes) and worker nodes for the Kubernetes cluster.
Kubernetes Cluster Configuration:
Once the control plane is up and running, Cluster API manages the configuration of the Kubernetes cluster, ensuring that it
aligns with the desired state specified by the user.
Worker Node Configuration:
Cluster API also takes care of configuring the worker nodes, joining them to the cluster, and ensuring they are in the desired
state.
Lifecycle Management:
The Cluster API controllers continuously monitor the cluster's state and reconcile any differences between the desired state
and the current state. This includes scaling the cluster up or down, updating the cluster version, and handling node failures.
8. Some Technologies Used in this Demo
• Gitlab CI
• ArgoCD - Declarative GitOps CD for Kubernetes
• Cloudstack - OpenSource Cloud Provider
• Cloudstack Cloud Monkey - CLI Interface for Cloudstack APIs
• Kubernetes Image Builder Project
• Hashicorp Packer - KVM Image Builder
• Clusterapi Operator - Manages Clusterapi Core + Bootstrap + Infra Providers
• DrOctopus Kubernetes Operator(Manages capc deployed clusters)
• Hashicorp Vault
9.
10.
11. Useful Links
• Kubernetes Image Builder Project - https://github.com/kubernetes-sigs/image-builder
• ArgoCD - https://argo-cd.readthedocs.io/en/stable/
• Cluster API - https://cluster-api.sigs.k8s.io/
• Cluster API Cloudstack Infra Provider - https://github.com/kubernetes-sigs/cluster-api-provider-cloudstack
• Cloudstack Documentation - http://docs.cloudstack.apache.org/en/4.18.1.0/
• Shapeblue Bootstrapping K8S Cluster using CAPC l CloudStack 'Feature First Look' Series -
https://www.youtube.com/watch?v=Du1pGriJzo8
• Gitlab CI - https://docs.gitlab.com/ee/ci/
• PCextreme Packer Templates - https://github.com/PCextreme/packer-templates
• Hashicorp Packer - https://www.packer.io/
• Hashicorp Vault - https://www.vaultproject.io/