doc/user/infrastructure/clusters/connect/new_civo_cluster.md
Every new Civo account receives $250 in credit to get started with the GitLab integration with Civo Kubernetes. You can also use a marketplace app to install GitLab on your Civo Kubernetes cluster.
Learn how to create a new cluster on Civo Kubernetes through Infrastructure as Code (IaC). This process uses the Civo and Kubernetes Terraform providers to create Civo Kubernetes clusters. You connect the clusters to GitLab by using the GitLab agent for Kubernetes.
Before you begin:
Steps:
To create a cluster from GitLab using Infrastructure as Code, you must create a project to manage the cluster from. In this tutorial, you start with a sample project and modify it according to your needs.
Start by importing the example project by URL.
To import the project:
https://gitlab.com/civocloud/gitlab-terraform-civo.git.This project provides you with:
To create a GitLab agent for Kubernetes:
civo-agent and select Register.Use CI/CD environment variables to configure your project.
Required configuration:
CIVO_TOKEN to the token from your Civo account.TF_VAR_agent_token to the agent token you received in the previous task.TF_VAR_kas_address to the agent server address in the previous task.Optional configuration:
The file variables.tf
contains other variables that you can override according to your needs:
TF_VAR_civo_region: Set your cluster's region.TF_VAR_cluster_name: Set your cluster's name.TF_VAR_cluster_description: Set a description for the cluster. To create a reference to your GitLab project on your Civo cluster detail page, set this value to $CI_PROJECT_URL. This value helps you determine which project was responsible for provisioning the cluster you see on the Civo dashboard.TF_VAR_target_nodes_size: Set the size of the nodes to use for the clusterTF_VAR_num_target_nodes: Set the number of Kubernetes nodes.TF_VAR_agent_version: Set the version of the GitLab agent for Kubernetes.TF_VAR_agent_namespace: Set the Kubernetes namespace for the GitLab agent for Kubernetes.Refer to the Civo Terraform provider and the Kubernetes Terraform provider documentation for further resource options.
After configuring your project, manually trigger the provisioning of your cluster. In GitLab:
When the pipeline finishes successfully, you can see your new cluster:
If you didn't set the TF_VAR_civo_region variable, the cluster will be created in the 'lon1' region.
After you provision the cluster, it is connected to GitLab and is ready for deployments. To check the connection:
For more information about the capabilities of the connection, see the GitLab agent for Kubernetes documentation.
A cleanup job is included in your pipeline by default.
To remove all created resources:
This Civo integration is supported by Civo. Send your support requests to Civo support.