Quick demonstration of how to utilize tkg-cli and Gitlab CICD to provision kubernetes cluster. This allows anyone to provision/scale/delete kubernetes cluster by just committing a cluster definition to git – a common usecase when employing GitOps.
Overview of how it’s done:
- Python script gets executed as part of the GitlabCICD which does a git diff to determine the appropriate action to perform
- Any files added in the cluster folder, perform a tkg create cluster
- Any files modified in the cluster folder, perform tkg scale cluster
- Any files deleted in the cluster folder, perform tkg delete cluster
The script- feel free to modify:
https://gitlab.com/dmnt3d/tkg-gitlab-cd
Add Kubernetes Cluster
![](https://letsdocloud.com/wp-content/uploads/2020/09/Add-Cluster-edited-3.gif)
Scale down Kubernetes Cluster
![](https://letsdocloud.com/wp-content/uploads/2020/09/Scale-down-edited.gif)
Delete Kubernetes Cluster
![](https://letsdocloud.com/wp-content/uploads/2020/09/Delete-Cluster-edited.gif)