.multicloud-article{
width:100%;
color:inherit;
line-height:1.85;
}
.multicloud-article p{
margin:0 0 18px;
line-height:1.85;
}
.multicloud-article h2{
margin:43px 0 17px;
font-size:clamp(23px,2.5vw,30px);
line-height:1.3;
font-weight:650;
color:inherit;
}
.multicloud-article h3{
margin:25px 0 12px;
font-size:19px;
line-height:1.4;
color:inherit;
}
.multicloud-article ul,
.multicloud-article ol{
margin:12px 0 22px;
padding-left:24px;
}
.multicloud-article li{
margin-bottom:9px;
line-height:1.75;
}
.multicloud-article strong{
color:#b8ff20;
font-weight:600;
}
.multicloud-article code{
color:#b8ff20;
font-family:'Space Mono',monospace;
font-size:.9em;
overflow-wrap:anywhere;
}
.multicloud-article pre{
margin:18px 0 24px;
padding:18px 20px;
overflow-x:auto;
border:1px solid rgba(155,123,255,.22);
border-left:3px solid #9b7bff;
border-radius:7px;
background:#11101d;
line-height:1.7;
}
.multicloud-article pre code{
color:#d9d5e8;
font-size:13px;
}
.multicloud-article .multicloud-media-row{
display:flex;
align-items:center;
gap:30px;
width:100%;
margin:30px 0 38px;
}
.multicloud-article .multicloud-media-text{
flex:1 1 58%;
min-width:0;
}
.multicloud-article .multicloud-media-image{
flex:0 1 42%;
min-width:0;
margin:0;
}
.multicloud-article .multicloud-media-image img{
display:block;
width:100%;
height:auto;
max-height:310px;
object-fit:contain;
border-radius:9px;
}
.multicloud-article .multicloud-media-image figcaption{
margin-top:10px;
text-align:center;
color:#9895ad;
font-size:12px;
line-height:1.6;
}
.multicloud-article .multicloud-media-row.reverse{
flex-direction:row;
}
.multicloud-article .multicloud-label{
display:flex;
align-items:center;
gap:9px;
margin-bottom:13px;
color:#b8ff20;
font-family:'Space Mono',monospace;
font-size:10px;
letter-spacing:1.7px;
text-transform:uppercase;
}
.multicloud-article .multicloud-label:before{
content:"";
width:19px;
height:1px;
background:#b8ff20;
}
.multicloud-article .multicloud-tech-list{
display:flex;
flex-wrap:wrap;
gap:9px;
margin:18px 0 24px;
}
.multicloud-article .multicloud-tech-list span{
display:inline-block;
padding:7px 11px;
border:1px solid rgba(155,123,255,.28);
border-radius:5px;
background:rgba(155,123,255,.06);
color:#d9d5e8;
font-family:'Space Mono',monospace;
font-size:11px;
line-height:1.5;
}
.multicloud-article .multicloud-github-link{
display:inline-flex;
align-items:center;
gap:9px;
margin:8px 0 18px;
color:#b8ff20;
font-weight:600;
text-decoration:none;
transition:color .25s ease;
}
.multicloud-article .multicloud-github-link:hover{
color:#d2ff75;
}
@media (max-width:767px){
.multicloud-article h2{
margin-top:34px;
}
.multicloud-article .multicloud-media-row,
.multicloud-article .multicloud-media-row.reverse{
flex-direction:column;
align-items:stretch;
gap:18px;
margin:25px 0 32px;
}
.multicloud-article .multicloud-media-text,
.multicloud-article .multicloud-media-image{
flex:1 1 100%;
width:100%;
}
.multicloud-article .multicloud-media-image img{
max-height:none;
margin:0 auto;
}
.multicloud-article pre{
padding:15px;
}
}
Running Kubernetes in one cloud environment is already a meaningful infrastructure exercise. Running it across two providers introduces another layer of responsibility: each platform has its own identity model, networking components, cluster configuration and operational requirements.
In this project, I worked with Amazon EKS and Azure AKS to provision Kubernetes infrastructure using Terraform and run the same containerized Flask application in both environments. While building the setup, I also had to consider how cluster access, cloud credentials, Terraform state and application exposure should be handled.
This article focuses on the infrastructure and security decisions behind the deployment, what I verified, and what I would strengthen before considering a similar architecture production-ready.
1. Why Deploy Kubernetes Across Two Cloud Providers?
Amazon EKS and Azure AKS both provide managed Kubernetes control planes, but they do not manage the surrounding cloud infrastructure in exactly the same way. Networking, identity, access configuration and infrastructure provisioning still need to be understood at the provider level.
My goal was to build two independent Kubernetes environments while keeping the application workload consistent. I used Terraform to define the cloud infrastructure, Docker to package the Flask application, and Kubernetes manifests to describe the workload.
The main technologies used in this project were:
- Amazon EKS: Managed Kubernetes on AWS.
- Azure AKS: Managed Kubernetes on Microsoft Azure.
- Terraform: Infrastructure provisioning through code.
- Kubernetes: Application deployment and service management.
- Docker: Containerizing the Flask application.
- GitHub Actions: Automating the Docker image build and publishing workflow.
2. Managing Access to Multiple Kubernetes Clusters
When working with multiple Kubernetes clusters, I need to know exactly which cluster my commands are targeting. A command executed against the wrong context can modify resources in an unintended environment.
Kubernetes contexts help solve this by keeping the cluster, user and namespace configuration together. In this project, I configured access to both cloud environments and used kubectl contexts to distinguish the EKS and AKS clusters.
This makes it easier to inspect the active environment before running deployment or troubleshooting commands. It is a simple operational safeguard, but an important one when managing more than one cluster.

Context management does not replace access control. The credentials associated with each context still determine what a user can do. In a production environment, I would combine clear context naming with least-privilege permissions and carefully managed access to kubeconfig files.
3. Provisioning EKS and AKS with Terraform
I separated the Terraform configuration for AWS and Azure into different directories. This keeps provider-specific resources and configuration independent while allowing both environments to be managed through Infrastructure as Code.
AWS EKS infrastructure
For AWS, I used the AWS VPC and EKS Terraform modules. The configuration creates a VPC with the CIDR range 10.0.0.0/16, two public subnets and two private subnets across availability zones in us-east-1.
The configuration also enables a single NAT Gateway and provisions an EKS cluster named multi-cloud-eks. The managed node group uses On-Demand t3.medium instances, with a desired size of one node and a maximum size of two.
One important networking decision is that the EKS cluster is connected to the private subnets, while both public and private Kubernetes API endpoint access are enabled. This provides more than one route for reaching the control plane, but it also means public API access needs to be considered carefully.
Azure AKS infrastructure
For Azure, I defined the resource group, virtual network, subnet and AKS cluster directly with Terraform resources. The virtual network uses 10.1.0.0/16, with a dedicated AKS subnet using 10.1.1.0/24.
The AKS cluster is configured with one node in its default node pool, using the Standard_DC2as_v5 VM size. I also configured a system-assigned managed identity for the cluster.
Using a managed identity provides an Azure-native way for the cluster to obtain access to supported Azure resources without placing a long-lived service principal secret directly in the Terraform configuration.
4. Credentials and Terraform State: What Needs Protection?
Infrastructure provisioning requires credentials that can create and modify cloud resources. Those credentials should not be treated like ordinary application configuration because anyone who obtains sufficiently privileged credentials may be able to change the underlying infrastructure.
In this project, the AWS provider configuration specifies the region, while the Azure provider configuration enables provider features. Neither provider block contains a hard-coded access key or client secret. Authentication is therefore supplied through the relevant provider authentication mechanisms outside those blocks.
The GitHub Actions workflow uses repository secrets for the Docker Hub username and token. The token is passed to Docker login through standard input rather than being written directly into the workflow file.
Terraform state requires separate attention. The project’s .gitignore excludes:
terraform.tfstate
terraform.tfstate.backup
.terraform/This helps prevent local state files and downloaded provider directories from being committed to Git. However, excluding a state file from version control does not automatically make the state secure. The supplied Terraform configuration does not define a remote backend.
For a team or production environment, I would use a remote state backend with encryption, access restrictions, state locking and a recovery strategy. I would also make sure that credentials used for Terraform have only the permissions required for the infrastructure operations being performed.
5. Networking and Application Exposure
The two cloud environments use separate virtual networks. AWS uses its VPC with public and private subnets, while Azure uses a dedicated virtual network and AKS subnet.
At the Kubernetes layer, the application is exposed through a Service with the type LoadBalancer. The Service listens on port 80 and forwards traffic to port 5000 on the application containers.
apiVersion: v1
kind: Service
metadata:
name: multi-cloud-app-service
spec:
type: LoadBalancer
selector:
app: multi-cloud-app
ports:
- port: 80
targetPort: 5000This allows the cloud provider’s integration with Kubernetes to provision a load balancer for the Service. It is convenient for demonstrating application access, but it also means that the exposure of the application must be considered at the cloud networking layer.
For a production setup, I would review the allowed inbound sources, add an appropriately configured ingress layer, enforce HTTPS and avoid exposing application endpoints more broadly than necessary. NetworkPolicies would also help define which workloads are allowed to communicate with one another inside the cluster.
6. Building the Container with GitHub Actions

I used GitHub Actions to automate the Docker image publishing process. The workflow is triggered by a push to the main branch.
It checks out the repository, authenticates with Docker Hub using GitHub repository secrets, builds the application image and pushes it to the registry.
The Dockerfile uses python:3.10-slim, installs the Flask application dependencies and starts the application on port 5000.
The successful workflow screenshot confirms that the image build-and-push job completed. It does not represent an automated Terraform apply or Kubernetes rollout.
There is also an important versioning detail in the current repository: the workflow publishes the image using the mutable latest tag, while the Kubernetes Deployment manifest references momnashahid/multi-cloud-app:v1. I would align these references and use immutable image tags, such as a commit SHA, to make it easier to identify exactly which application version is running.
7. Verifying the Application on AWS EKS
After configuring the EKS environment, I verified that the Flask application was running in the AWS Kubernetes cluster.
The Kubernetes Deployment defines two replicas of the application. This allows Kubernetes to maintain the requested number of application Pods, subject to available cluster resources.
The application exposes a simple home route and a /health endpoint. The screenshot provides visual evidence that the application was accessible through the AWS deployment.
This confirms application availability at the time of verification, although it is not a substitute for automated health probes, load testing or security testing.

8. Verifying the Application on Azure AKS

I also verified the application in the Azure AKS environment. The same Flask workload was running through the Kubernetes resources configured for the project.
Using the same application and Kubernetes manifests across both environments helped demonstrate workload portability. The cloud infrastructure and cluster access mechanisms remained provider-specific, while the application-level deployment structure stayed familiar.
These two deployment checks gave me a practical way to compare how the same containerized application behaves across two managed Kubernetes services.
9. Security Controls I Would Strengthen Next
Deploying an application successfully is not the same as making a Kubernetes environment production-ready. Reviewing the actual manifests and Terraform configuration also helped identify areas where stronger security controls would be needed.
Some of the most important improvements I would prioritize are:
- Least-privilege access: Replace broad cluster-administrator access with dedicated roles and narrowly scoped permissions. The EKS configuration currently enables cluster-creator administrator permissions.
- API endpoint restrictions: Review public Kubernetes API access and restrict it to trusted networks where possible. The EKS configuration enables both public and private endpoint access.
- Pod security: Add an explicit security context, run containers as a non-root user where supported, and prevent unnecessary privilege escalation.
- Network isolation: Introduce Kubernetes NetworkPolicies and review cloud firewall or security-group rules to control allowed traffic.
- Workload reliability: Add readiness and liveness probes, as well as CPU and memory requests and limits.
- Image security: Scan container images for known vulnerabilities and use immutable image tags rather than relying on a mutable
latesttag. - Infrastructure state protection: Move from local Terraform state to a secured remote backend with encryption, locking and controlled access.
- Deployment automation: Extend the existing workflow with controlled Terraform and Kubernetes deployment stages, environment-specific approvals and post-deployment verification.
These are recommended improvements, not controls that I am claiming were already implemented or tested in this project. A future iteration could validate them with Kubernetes policy checks, container scanning, access-control tests and network verification.
10. Multi-Cloud Trade-offs and Operational Lessons
Using two cloud providers offers flexibility, but it also increases operational complexity. Each environment has its own infrastructure resources, identity mechanisms, networking configuration and cost model.
In this project, the AWS environment includes an EKS managed node group using On-Demand EC2 capacity and a NAT Gateway. Azure uses an AKS node pool with its own VM size and managed identity. Both environments also require the supporting networking and load-balancing resources.
These components can create ongoing costs even when the application workload is small. A NAT Gateway, managed Kubernetes control plane, worker nodes, public load balancers and data transfer can all contribute to the total cost. Actual costs depend on region, usage, pricing and how long the resources remain provisioned.
Operationally, I would also need to maintain separate cloud access, monitor both clusters, manage upgrades and ensure that application configurations remain consistent. Multi-cloud should therefore be driven by a real availability, resilience or business requirement—not simply by adding another provider.
Conclusion
This project helped me understand that multi-cloud Kubernetes is not just about deploying the same container twice. The infrastructure, credentials, cluster access, network exposure and operational responsibilities all need to be considered separately for each provider.
Working with Terraform, EKS, AKS, Kubernetes and GitHub Actions gave me practical experience connecting infrastructure provisioning with containerized application deployment. Reviewing the implementation also showed me where a working deployment needs additional hardening before it can be treated as production-ready.
My biggest takeaway is that security should be part of the infrastructure design from the beginning. Clear access boundaries, protected credentials, controlled network exposure, secure state management and repeatable deployment processes are all essential parts of operating Kubernetes across cloud environments.
Project Repository
The complete source code, Terraform configurations, Kubernetes manifests and workflow are available on GitHub:
View the Multi-Cloud Kubernetes Project on GitHub →
Technologies: Kubernetes · Amazon EKS · Azure AKS · Terraform · Docker · GitHub Actions · Python · Flask · AWS VPC · Azure Virtual Network