cloud-foundation-fabric/blueprints/gke/autopilot
simonebruzzechesse d11c380aec
Format python files in blueprints (#2079)
* format python files in blueprints
* update check on blueprints python code
* update python linter in CI workflow
2024-02-15 09:37:49 +01:00
..
ansible versions.tf maintenance + copyright notice bump (#1782) 2023-10-20 18:17:47 +02:00
bundle Format python files in blueprints (#2079) 2024-02-15 09:37:49 +01:00
templates Added autopilot blueprint 2023-03-07 15:37:20 +01:00
README.md Make deletion protection consistent across all modules (#1735) 2023-10-05 17:31:07 +02:00
ansible.tf Fixed permissions of files created 2023-03-27 14:49:09 +02:00
cluster.tf Make deletion protection consistent across all modules (#1735) 2023-10-05 17:31:07 +02:00
diagram.png Added autopilot blueprint 2023-03-07 15:37:20 +01:00
glbs.tf [net-address] enable ipv6 (#1821) 2023-10-28 15:36:30 +02:00
main.tf update and refactor artifact registry module (#1536) 2023-07-28 09:54:36 +00:00
mgmt.tf Allow using no service account in compute-vm (#1692) 2023-09-19 16:56:51 +00:00
outputs.tf Added autopilot blueprint 2023-03-07 15:37:20 +01:00
variables.tf Make deletion protection consistent across all modules (#1735) 2023-10-05 17:31:07 +02:00
vpc.tf Autopilot fixes 2023-03-13 12:55:45 +01:00

README.md

Load testing an application running on an autopilot cluster

This blueprint creates an Autopilot cluster with Google-managed Prometheus enabled and installs an application that scales as the traffic that is hitting the load balancer exposing it grows. It also installs the tooling required to distributed load test with locust on that application and the monitoring tooling required to observe how things evolve in the cluster during the load test. Ansible is used to install the application and all the tooling on a management VM.

The diagram below depicts the architecture.

Diagram

Running the blueprint

  1. Clone this repository or open it in cloud shell, then go through the following steps to create resources:

  2. Initialize the terraform configuration

    terraform init
    
  3. Apply the terraform configuration

    terraform apply -var project_id=my-project-id
    
  4. Copy the IP addresses for grafana, the locust master.

  5. Change to the ansible directory and run the following command

    ansible-playbook -v playbook.yaml
    
  6. Open to the locust master web interface url in your browser and start the load test

  7. SSH to the management VM

    gcloud compute ssh mgmt --project my-project
    
  8. Run the following command to check that the application pods are running on different nodes than the load testing and monitoring tooling.

    kubectl get pods -A -o wide
    
  9. Run the following command to see how the application pods scale

    kubectl get hpa -n sample -w
    
  10. Run the following command to see how the cluster nodes scale

    kubectl get nodes -n
    

Alternatively you can also check all the above using the dashboards available in grafana.

Variables

name description type required default
project_id Project ID. string
cluster_network_config Cluster network configuration. object({…}) {…}
deletion_protection Prevent Terraform from destroying data storage resources (storage buckets, GKE clusters, CloudSQL instances) in this blueprint. When this field is set in Terraform state, a terraform destroy or terraform apply that would delete data storage resources will fail. bool false
mgmt_server_config Management server configuration. object({…}) {…}
mgmt_subnet_cidr_block Management subnet IP CIDR range. string "10.0.2.0/24"
project_create Parameters for the creation of the new project. object({…}) null
region Region. string "europe-west1"
vpc_create Flag indicating whether the VPC should be created or not. bool true
vpc_name VPC name. string "vpc"

Outputs

name description sensitive
urls Grafanam, locust and application URLs.

Test

module "test" {
  source = "./fabric/blueprints/gke/autopilot"
  project_create = {
    billing_account_id = "12345-12345-12345"
    parent             = "folders/123456789"
  }
  project_id = "my-project"
}
# tftest modules=11 resources=36