Migrate a Kubernetes application to GCP from AWS

9/22/2021

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.

-- Alberto Piñón Formoso
amazon-web-services
google-cloud-platform
kubernetes
migration
terraform

2 Answers

9/23/2021

It depends.

At first, AWS -> GCP resources mapping:

At first, you'll want to know the mapping between AWS and GCP resources. There are several articles:

Migrate AWS EKS to GCP GKE: the hard way

If your cluster is deployed with managed kubernetes service:

  • from Elastic Kubernetes Service (EKS)
  • to 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`

Migrate VMs and cluster deployed using your own 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:

  • Either migrate VMs using GCP Migrate Connector (as @vicente-ayala said in his answer)
  • Or import your infrastructure to the terraform manifest, change resources definitions step-by-step, and then apply this updated manifest to GCP

Migrating with Migrate Connector

You can found the latest migration manual on migrating VM's here:

Prerequisites

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:

Migrating

How-to Guides  |  Migrate for Compute Engine  |  Google Cloud

Migrating using 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

Additional resources on AWS <-> GCP

-- Yasen
Source: StackOverflow