/multi-cloud-terraform-module

Terraform module that creates and deploys your kubernetes cluster across multiple cloud infrastructure providers like AWS and GCP. It sets up a load balancer that round-robins requests across clusters. Whether it's AWS or others, downtime’s got nothing on you.

Primary LanguageHCL

Terraform Multi-Cloud Module

Terraform module for multi-cloud infrastructure (EKS/GKE)

The goal here is to provision multi-cloud infrastructure using Kubernetes services from different cloud providers (AWS, GCP) that could bring forth several advantages including high availability, optimal performance and increased flexibility.

Prequisites

  • AWS Account
  • GCP Project
  • CLI tools
    • terraform
    • kubectl
    • aws
    • gcloud

Modules

Example

  1. Create EKS cluster with Fargate profile and AWS load balancer controller
# 1. Go to directory
cd examples/aws-eks-fargate

# 2. Create terraform variables file.
cp terraform.tfvars.sample terraform.tfvars

# 3. Enter AWS credentials in terraform.tfvars
aws_access_key_id     = "<ACCESS_KEY>"
aws_access_secret_key = "<ACCESS_SECRET>"

# 3. Initialize terraform
terraform init

# 4. Apply infrastructure
terraform apply
  1. Create GKE cluster in autopilot mode
# 1. Go to directory
cd examples/gcp-gke-autopilot

# 2. Create terraform variables file.
cp terraform.tfvars.sample terraform.tfvars

# 3. Enter GCP project ID in terraform.tfvars
project_id            = "<PROJECT_ID>"

# 3. Initialize terraform
terraform init

# 4. Apply infrastructure
terraform apply
  1. Deploy sample application to both EKS and GCP cluster. This will also setup load balancers in respective cloud cluster
# 1. Go to directory
cd examples/multi-cloud-sample-app

# 2. Create terraform variables file.
cp terraform.tfvars.sample terraform.tfvars

# 3. Enter AWS & GCP credentials in terraform.tfvars
aws_access_key_id     = "<ACCESS_KEY>"
aws_access_secret_key = "<ACCESS_SECRET>"
project_id            = "<PROJECT_ID>"

# 3. Initialize terraform
terraform init

# 4. Apply infrastructure
terraform apply
  1. Provision NGINX load balancer in EC2 instance which distributes the traffic to EKS & GKE load balancer
# 1. Go to directory
cd examples/multi-cloud-nginx-lb

# 2. Create terraform variables file.
cp terraform.tfvars.sample terraform.tfvars

# 3. Enter AWS & GCP credentials in terraform.tfvars
aws_access_key_id     = "<ACCESS_KEY>"
aws_access_secret_key = "<ACCESS_SECRET>"
project_id            = "<PROJECT_ID>"

# 3. Initialize terraform
terraform init

# 4. Apply infrastructure
terraform apply

Roadmap

  • AWS EKS Cluster
  • GKE cluster autopilot mode
  • EKS multi-region cluster using Global Accelerator
  • GKE multi-region cluster using MCS (Multi Cluster Service)
  • Multi-cloud load balancing with failover