I want to know a brief explanation or an example of how to migrate a Kubernetes
application to GCP
from AWS
.
What services are implicated like EKS
or EC2
and GKE
or Compute Engine
.
I'm very new to migration, I don't know too much about AWS
and I recently started using GCP
.
Thanks in advance.
It depends.
AWS
-> GCP
resources mapping:At first, you'll want to know the mapping between AWS
and GCP
resources.
There are several articles:
AWS EKS
to GCP GKE
: the hard wayIf your cluster is deployed with managed kubernetes service:
Elastic Kubernetes Service
(EKS
)Google Kubernetes Engine
(GKE
)Then it would be hard to migrate. Just due to complexity of kubernetes
architecture and differences in the approaches of manage cluster in AWS
vsGCP`
k8s
manifest.If your kubernetes
cluster is deployed on cloud virtual machines with k8s
or helm
manifests, then it would be easier.
And there are two ways:
VM
s using GCP
Migrate Connector
(as @vicente-ayala said in his answer)terraform
manifest, change resources definitions step-by-step, and then apply this updated manifest to GCP
Migrate Connector
You can found the latest migration manual on migrating VM's here:
As per GCP
manual,
Before you can migrate a source VM to Google Cloud, you must configure the migration environment on your on-premises data center and on Google Cloud. See:
How-to Guides | Migrate for Compute Engine | Google Cloud
Terraform
and Terraformer
There is a great tool for reverse Terraform GoogleCloudPlatform/terraformer. Infrastructure to Code
A CLI tool that generates tf
/json
and tfstate
files based on existing infrastructure (reverse Terraform).
And you can import your infrastructure into terraform
manifest:
terraformer import aws --resources=vpc,subnet --connect=true --regions=eu-west-1 --profile=prod
You'll get the terraform
manifest declared with aws provider
And you may try to replace every AWS
resource to the appropriate GCP
resource. There is official terraform GCP
provider: hashicorp/google. Unfortunately, there isn't mapping for terraform
resources of both cloud providers. But, again, you may some of these mapping lists:
And then apply the new GCP
manifest:
terraform init
terraform plan
terraform apply
AWS
<-> GCP
Here is a detailed guide of steps you need to perform to migrate you k8s cluster from AWS to GCP.
https://cloud.google.com/migrate/compute-engine/docs/4.8/how-to/migrate-aws-to-gcp/overview
https://cloud.google.com/migrate/compute-engine/docs/4.8/how-to/migrate-aws-to-gcp/aws-prerequisites