Multicloud Kubernetes Deployment: GKE + AKS + EKS
Project Overview
In this project, we deploy three separate applications to different cloud Kubernetes clusters:
- GKE (Google Kubernetes Engine): Flask Web App
- AKS (Azure Kubernetes Service): Node.js API
- EKS (Amazon Elastic Kubernetes Service): Django Web App
Each cloud runs independently, but we can manage all clusters from a single workstation using kubectl with multiple contexts.
Step 1: Create Kubernetes Clusters
Run these commands locally on your terminal. You need the respective cloud CLIs installed (gcloud, az, aws).
GKE:
gcloud container clusters create gke-blog-cluster \
--zone us-central1-a --num-nodes 2
AKS:
az aks create --resource-group aks-rg --name aks-api-cluster \
--node-count 2 --generate-ssh-keys
EKS:
aws eks create-cluster --name eks-django-cluster \
--role-arn --resources-vpc-config subnetIds=,securityGroupIds=
Step 2: Configure kubectl for Multiple Clusters
After creating the clusters, configure kubectl to access each one:
# GKE
gcloud container clusters get-credentials gke-blog-cluster --zone us-central1-a
# AKS
az aks get-credentials --resource-group aks-rg --name aks-api-cluster
# EKS
aws eks --region us-east-1 update-kubeconfig --name eks-django-cluster
Now your kubectl knows about three clusters. You can see all contexts:
kubectl config get-contexts
Switch between clusters using:
kubectl config use-context gke_blog_cluster_context
kubectl config use-context aks_api_cluster_context
kubectl config use-context eks_django_cluster_context
Step 3: Deploy Applications to Each Cluster
Important: Switch to the desired context before deploying to each cloud.
GKE Flask App:
kubectl config use-context gke_blog_cluster_context
kubectl create deployment flask-app --image=yourusername/flask-blog
kubectl expose deployment flask-app --type=LoadBalancer --port 80
AKS Node.js API:
kubectl config use-context aks_api_cluster_context
kubectl create deployment node-api --image=yourusername/node-api
kubectl expose deployment node-api --type=LoadBalancer --port 3000
EKS Django App:
kubectl config use-context eks_django_cluster_context
kubectl create deployment django-app --image=yourusername/django-web
kubectl expose deployment django-app --type=LoadBalancer --port 8000
Step 4: Connect and Test Applications
Retrieve external IP addresses:
kubectl get svc
Visit each external IP in your browser to verify the app is running.
Optional: Use a single DNS provider (Cloudflare or Route53) to map domain names to each application, allowing easy access:
- flask-app.example.com → GKE
- node-api.example.com → AKS
- django-app.example.com → EKS
Step 5: Optional: Inter-Cluster Communication
If you want the applications to communicate across clouds:
- Set up VPNs or VPC Peering between clouds
- Expose APIs securely using Ingress + TLS
- Consider using a multicloud service mesh like Istio for service discovery and traffic routing
Benefits of This Approach
- Leverage strengths of each cloud provider
- Avoid vendor lock-in
- Compare performance across clouds
- Provide high availability and redundancy