Cluster API Operator • Quick Start

Cluster API Operator • Quick Start

Audience

If you are reading this blog chances are that you are a Software/Dev Ops Engineer who is either interested in deploying Kubernetes Clusters using Cluster API or writing controllers that do a similar thing.

Regardless of who you are, if you have experience deploying Kubernetes Clusters using Cluster API please continue, if you are new to Cluster API I would recommend you try out cluster creation and get familiar with Cluster API first.

Problem Statement

If you have managed Bootstrap clusters in the past, you are aware of the nuances of manually initializing Bootstrap clusters. To remember which versions of Cluster API and Cluster API Provider versions are installed on the cluster (I bet you have checked the deployment image name or some other info to figure out these details). clusterctl Does a very good job at Bootstrap cluster creation and User Experience around installing components, but doesn’t solve the above-mentioned problem.

To elaborate more take Day 2 operations into consideration. Imagine your Organization has 20 Bootstrap Clusters and you are tasked to update the dependencies to the latest. Some Bootstrap clusters might have drifted versions and settings. To add more to your problem if some clusters have feature gates enabled, imagine the degree to which it has made your job difficult. You have to manually check every bootstrap cluster for Cluster API and Cluster API Providers' versions and compatible feature gates.

To summarize the problem

  • Managing multiple bootstrap clusters can be tricky.

  • Multiple bootstrap clusters can have Cluster API component version drift if managed manually, one cluster can have a 1.8.4 version of Cluster API while the other has 1.8.5 installed.

  • Creating a bootstrap cluster is easy upgrading the Cluster API component is a bit tedious task. Users have to download manifests for new releases and upgrade multiple clusters one by one a highly error-prone process.

Community Solution

Cluster API Operator brings a Git Ops first approach to manage Cluster API and Cluster API providers for a bootstrap cluster.
Providing a declarative API for creating and managing the lifecycle for Cluster API and Cluster API Provider components using CustomResources.

Cluster API Operator allows users to specify Cluster API component manifests using GitHub Release URLs, and configmaps and even allows a neat way to install and manage providers in air-gapped clusters.

A Sample CoreProvider Custom Resource

Series Introduction

Goal of this series is to get familiar with the Cluster API Operator & document my knowledge here. This is a five-part series broadly outlined as

  • Cluster API Operator Introduction (this article)
    Cover basic problems we face while managing Cluster API Bootstrap Clusters.
    Introduce Cluster API Operator as a solution for the same.
    Quick demo using kind and Cluster API Provider Docker

  • Cluster API Operator API Specifications
    *
    Introduce v1alpha2 APIs CoreProvider, BootstrapProvider, ControlPlaneProvider, InfrastructureProvider, AddonProvider & IPAMProvider.*

  • Cluster API Operator API ProviderSpec
    *
    Deep dive into specifying the provider manifest locations and other customization*

  • Cluster API Operator Managing Provider Lifecycle
    Create and Upgrade a Cluster API Provider version, and understand limitations and nuances.

  • Cluster API Operator end-to-end demo using Flux
    Showcase end-to-end demo for Cluster API Operator using Flux as CD tool with GitHub and air-gapped mode using FetchConfiguration .

Demo

Prerequisites. Kubernetes Cluster, kubectl, helm & Internet Access.

  • Step 1. Setup cert-manager & Cluster API Provider helm repo

helm repo add capi-operator https://kubernetes-sigs.github.io/cluster-api-operator
helm repo add jetstack https://charts.jetstack.io --force-update
helm repo update

Ensure repos are added correctly and updated before proceeding

  • Step 2. Install cert-manager

helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true

Make sure cert-manager is installed correctly in your cluster.

  • Step 3. Wait for cert-manager to become ready followed by installing Cluster API Provider

helm install capi-operator capi-operator/cluster-api-operator --create-namespace -n capi-operator-system --set infrastructure=docker  --wait --timeout 90s

This step takes time even after the main helm command is exited, please wait and watch the capi, bootstrap, control-plane and CAPD manager pods.

  • Step 4. Verify Cluster API Provider Docker InfrastructureProvider is installed in the cluster

kubectl get infrastructureproviders.operator.cluster.x-k8s.io -A -o yaml

Similarly, users can look for coreproviders.operator.cluster.x-k8s.io, bootstrapproviders.operator.cluster.x-k8s.io & controlplaneproviders.operator.cluster.x-k8.. as well.

This concludes the first article, thanks a lot for your time. If you have any questions about the above or Cluster API please feel free to reach out Deepak Sharma .

Stay tuned for the next article, where we will explore Cluster API Operator APIs.