cloud-foundation-fabric/blueprints/gke/autopilot
Avinash Jha e881537f87
Separating GKE Standard and Autopilot Modules (#1330)
* separating GKE Standard and Autopilot Modules

* Changes for Updating the terraform and provide versions

* Changes for Autopilot Readme

* Changes for Autopilot Variable

* Changes for Autopilot Readme

* Changes for Autopilot Readme

* Changes for Blueprint

* Changes for Blueprint ReadMe

* Changes for gke-standard-cluster dependency

* Changes for gke-standard-cluster in gke-fleet

* Changes for gke-standard-cluster in cluster-mesh-gke-fleet-api

* python formatting

* python formatting

* python formatting

* GKE module naming convention

* Readme Changes

* test module

* Removing comment code from Autopilot
2023-04-21 12:08:13 +00:00
..
ansible Added autopilot blueprint 2023-03-07 15:37:20 +01:00
bundle Fixed wait_time in locust script 2023-04-11 21:42:06 +02:00
templates Added autopilot blueprint 2023-03-07 15:37:20 +01:00
README.md Autopilot fixes 2023-03-13 12:55:45 +01:00
ansible.tf Fixed permissions of files created 2023-03-27 14:49:09 +02:00
cluster.tf Separating GKE Standard and Autopilot Modules (#1330) 2023-04-21 12:08:13 +00:00
diagram.png Added autopilot blueprint 2023-03-07 15:37:20 +01:00
glbs.tf Added autopilot blueprint 2023-03-07 15:37:20 +01:00
main.tf Autopilot fixes 2023-03-13 12:55:45 +01:00
mgmt.tf Fixes related to boot_disk in compute-vm module 2023-03-16 15:58:39 +01:00
outputs.tf Added autopilot blueprint 2023-03-07 15:37:20 +01:00
variables.tf Autopilot fixes 2023-03-13 12:55:45 +01: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({…}) {…}
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=34