This Terraform project can be used to create a test environment on GCP to run the K8s conformance tests for the Mia-Platform distribution.
The projects requires a minimal set of configuration as input of the terraform module,
you can choose to set them via flags or via a terraform.auto.tfvars file.
When you have the values that you want to set, run the following commands:
terraform init
terraform plan -out=plan.tfplan <optional -var flags>The plan should create these resources, and showing as output the public IP address of the control-plane.
Finally, run:
terraform apply plan.tfplanThe initialization of the nodes may take a few minutes. You can check the cluster status by checking when the
control plane port is open on the public IP adress that terraform will show you with netcat:
nc -v <public-ip> 6443Or via telnet:
telnet <public-ip> 6443You may now connect to the control plane via ssh, we suggest the usage of the gcloud command that Google will
give you via the UI.
Once inside the control-plane become the root user and you will find a configured context for connecting
to the cluster, you may now setup your preferred connection method for interacting with the cluster via the public
endpoint.
Requisites:
# Install hooks in .git/hooks/pre-commit
pre-commit install --install-hooks
# (optional) Run manually pre-commit hooks to check if all its working
pre-commit run -a| Name | Version |
|---|---|
| terraform | >= 1 |
| ~> 7 | |
| random | ~> 3.7 |
| Name | Version |
|---|---|
| 7.3.0 | |
| random | 3.7.2 |
No modules.
| Name | Type |
|---|---|
| google_compute_firewall.allow_iap_access | resource |
| google_compute_firewall.allow_node_ports | resource |
| google_compute_firewall.allow_nodes_communication | resource |
| google_compute_firewall.allow_public_access | resource |
| google_compute_instance.control_plane | resource |
| google_compute_instance.worker | resource |
| google_compute_network.network | resource |
| google_compute_subnetwork.subnetwork | resource |
| random_string.join_token_first_part | resource |
| random_string.join_token_second_part | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| cluster_version | The version of Kubernetes that will run on the cluster. | string |
"1.33" |
no |
| nodes_network_cidr | The IP CIDR of the Kubernetes clusrter nodes. Default to 172.16.0.0/24 | string |
"172.16.0.0/24" |
no |
| pod_network_cidr | The IP CIDR of the pods in the Kubernetes cluster. Default to 10.10.0.0/16 | string |
"10.10.0.0/16" |
no |
| project | The Google project ID. | string |
n/a | yes |
| region | The region where the cluster will be created. | string |
"europe-west1" |
no |
| worker_count | The number of worker nodes of the cluster. Default to 3 | number |
3 |
no |
| Name | Description |
|---|---|
| control_plane_public_ip | The public IP for connecting to the cluster control plane |