Prerequisite
Kubernetes cluster — I have used a kind cluster on my local machine. For demo and follow-through purposes this should be enough, if you want to use a proper cloud or self-hosted cluster and use it as a Bootstrap cluster for later, the steps should remain the same.
GitHub Account — This tutorial is very tightly coupled with GitHub any other provider should also be fine. A few steps will be different for different Git Hosting providers
GitHub Token (Classic) — A GitHub Administrator token is required to be created. For brevity, I have used the token with the same privilege. If your organization or administrator does not allow using these tokens, you might want to use your personal account.
git patches downloaded — Please ensure you have downloaded git patches [link] in your local system. If you don’t feel comfortable using git patches I would recommend using this tutorial as reference
Flux Bootstrap
If you are familiar with the Flux bootstrap process it’s great you are off to a good start. If not it’s very easy, let’s start right away.
Only change that we have in our repo is that patches are organized to
clusters/production
instead ofclusters/my_cluster
as mentioned in the Flux tutorial.
Hence please use the following commands
export GITHUB_TOKEN=<gh-token>
flux bootstrap github \
--token-auth \
--owner=<my-github-username> \
--repository=<my-repository-name> \
--branch=main \
--path=clusters/production \
--personal
For details please refer to the steps mentioned in the Flux tutorial
Flux Bootstrap
Flux Components installed on the cluster
Please make sure that you have cloned the newly created repo on your. local system before proceeding further.
Clone Flux created repo
Install Cert Manager
Ensure that you have access Install Cert Manager.patch file.
Now inside your cloned repo please apply the patch.
Apply Install Cert Manager.patch
Above commands will
git apply ~/Install\ Cert\ Manager.patch
- apply patch
git add .
- add new files to the git repo
git commit -m "Add cert manager"
- commit files
git push
- push to upstream
If it suits your need please feel free to perform these operations individually.
Pushing changes to GitHub
After changes are pushed to the GitHub repo you must see that the Cert Manager components are installed on the cluster.
Cert Manager installed
Install CAPI Operator
Ensure that you have access Install CAPI Operator.patch file.
Now inside your cloned repo please apply the patch.
Apply Install CAPI Operator.patch
Above commands will
git apply ~/Install\ CAPI\ Operator.patch
- apply patch
git add .
- add new files to the git repo
git commit -m "Add capi operator"
- commit files
git push
- push to upstream
If it suits your need please feel free to perform these operations individually.
Pushing changes to GitHub
This will install the CAPI Operator alone, please remember that as part of this patch, we have only installed the operator and not applied the Provider Customer Resource which results in installing individual Provider. That will be taken in the next step.
CAPI Operator Installed
Install Provider Custom Resources
Ensure that you have access Add Providers.patch file.
Now inside your cloned repo please apply the patch.
Apply App Provider.patch
Above commands will
git apply ~/Add\ Providers.patch
- apply patch
git add .
- add new files to git repo
git commit -m "Add providers"
- commit files
git push
- push to upstream
If it suits your need please feel free to perform these operations individually.
Pushing changes to GitHub
Once changes are pushed you should be able to see Providers getting installed in the cluster.
Providers installed
Docker InfrastructureProvider Installed
Now that providers are installed creating and managing clusters using Cluster API is easy users can control Git Ops enabled repo to perform upgrades on Providers and manage CAPI Operator objects lifecycle.