Skip to content

Latest commit

 

History

History
 
 

multi-cluster-mesh-gke-fleet-api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Multi-cluster mesh on GKE (fleet API)

The following blueprint shows how to create a multi-cluster mesh for two private clusters on GKE. Anthos Service Mesh with automatic control plane management is set up for clusters using the Fleet API. This can only be done if the clusters are in a single project and in the same VPC. In this particular case both clusters having being deployed to different subnets in a shared VPC.

The diagram below depicts the architecture of the blueprint.

Architecture diagram

Terraform is used to provision the required infrastructure, create the IAM binding and register the clusters to the fleet.

Ansible is used to execute commands in the management VM. From this VM there is access to the cluster's endpoint. More specifically the following is done using Ansible:

  1. Install required dependencies in the VM
  2. Enable automatic control plane management in both clusters.
  3. Verify the control plane has been provisioned for both clusters.
  4. Configure ASM control plane endpoint discovery between the two clusters.
  5. Create a sample namespace in both clusters.
  6. Configure automatic sidecar injection in the created namespace.
  7. Deploy a hello-world service in both clusters
  8. Deploy a hello-world deployment (v1) in cluster a
  9. Deploy a hello-world deployment (v2) in cluster b
  10. Deploy a sleep service in both clusters.
  11. Send requests from a sleep pod to the hello-world service from both clusters, to verify that we get responses from alternative versions.

Running the blueprint

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

  • terraform init
  • terraform apply -var billing_account_id=my-billing-account-id -var parent=folders/my-folder-id -var host_project_id=my-host-project-id -var fleet_project_id=my-fleet-project-id -var mgmt_project_id=my-mgmt-project-id

Once terraform completes do the following:

  • Change to the ansible folder

      cd ansible
    
  • Run the ansible playbook

      ansible-playbook -v playbook.yaml
    

Testing the blueprint

The last two commands executed with Ansible Send requests from a sleep pod to the hello-world service from both clusters. If you see in the output of those two commands responses from alternative versions, everything works as expected.

Once done testing, you can clean up resources by running terraform destroy.

Variables

name description type required default
billing_account_id Billing account id. string
fleet_project_id Management Project ID. string
host_project_id Project ID. string
mgmt_project_id Management Project ID. string
parent Parent. string
clusters_config Clusters configuration. map(object({…})) {…}
istio_version ASM version string "1.14.1-asm.3"
mgmt_server_config Mgmt server configuration object({…}) {…}
mgmt_subnet_cidr_block Management subnet CIDR block. string "10.0.0.0/28"
region Region. string "europe-west1"