⬡ Hub
Skip to content

To spin up two Amazon EKS clusters in different AWS regions and enable both to handle requests, you should create a multi-region, highly available deployment using AWS services. The standard solution involves deploying your application to both clusters, exposing them with AWS Load Balancer Controllers (ALB), and using AWS Global Accelerator (or Route 53) for cross-region load balancing and failover. Here’s a concise step-by-step solution, suitable as a .md file for technical use.​

Multi-Region Amazon EKS Cluster Setup Prerequisites AWS CLI v2

eksctl

kubectl

helm

Two AWS regions (e.g., us-east-1 and ap-south-1)

An owned domain with a Route 53 hosted zone

Steps 1. Create EKS Clusters bash eksctl create cluster --name eks-cluster-1 --region us-east-1 eksctl create cluster --name eks-cluster-2 --region ap-south-1 2. Configure kubeconfig for Both Clusters bash aws eks --region us-east-1 update-kubeconfig --name eks-cluster-1 --alias eks-cluster-1 aws eks --region ap-south-1 update-kubeconfig --name eks-cluster-2 --alias eks-cluster-2 3. Install AWS Load Balancer Controller on Both Clusters Configure OIDC provider and IAM policies for each cluster:

bash eksctl utils associate-iam-oidc-provider --region --cluster --approve curl -o iam_policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/main/docs/install/iam_policy.json aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json

eksctl create iamserviceaccount \ --region --cluster \ --namespace kube-system --name aws-load-balancer-controller \ --attach-policy-arn arn:aws:iam:::policy/AWSLoadBalancerControllerIAMPolicy \ --approve --override-existing-serviceaccounts Install the controller:

bash helm repo add eks https://aws.github.io/eks-charts kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master" helm upgrade -i aws-load-balancer-controller eks/aws-load-balancer-controller \ -n kube-system --set clusterName= --set serviceAccount.create=false \ --set serviceAccount.name=aws-load-balancer-controller Repeat these steps for both clusters.

  1. Deploy Application in Both Clusters Example YAML for your service and ingress:

text apiVersion: apps/v1 kind: Deployment metadata: name: your-app spec: replicas: 2 selector: matchLabels: app: your-app template: metadata: labels: app: your-app spec: containers: - name: your-app image: ports: - containerPort: 80


apiVersion: v1 kind: Service metadata: name: your-app spec: selector: app: your-app ports: - protocol: TCP port: 80 targetPort: 80 type: NodePort


apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: your-app-ingress annotations: kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing spec: rules: - http: paths: - path: /* pathType: ImplementationSpecific backend: service: name: your-app port: number: 80 Apply to both clusters:

bash kubectl --context=eks-cluster-1 apply -f app.yaml kubectl --context=eks-cluster-2 apply -f app.yaml 5. Set Up AWS Global Accelerator Create an accelerator and register both ALB DNS names as endpoints.

Assign weights or active-active routing as needed.

bash aws globalaccelerator create-accelerator --name multi-region

...add listeners and endpoint groups using the ALB DNS names from both clusters

  1. (Optional) DNS with Route 53 To use your domain:

Point your domain/subdomain (e.g., app.example.com) to the Global Accelerator endpoint using an A record (alias) in Route 53.

Summary This approach allows your app to be accessible from both regions, with intelligent routing and failover for high availability and resilience. The provided commands and example YAMLs offer a production-ready starting point. Adjust and script as needed for your environment.​

For advanced scenarios (active-active handling, custom health checks, etc.), further tweak DNS, Global Accelerator, and application deployment strategies for stateful workloads.​