Keep up with the latest announcements from Google Cloud Next '21. Click here.

Developers & Practitioners

Automate Application Migration with GKE Autopilot and Migrate for GKE

Many developers today are choosing to develop and deploy new greenfield applications on Google Kubernetes Engine (GKE). And it’s easy to understand why—GKE offers a great combination of scalability, security, and ease of use. 

However, what might surprise a lot of people is that GKE is also often chosen to run existing brownfield workloads. For instance, applications that were previously deployed on virtual machines. 

Companies choose to migrate their workloads from VMs to containers for any number of reasons:

  • Allow for greater agility
  • Reduce licensing costs as well as operational costs
  • Move off of end of life operating systems
  • And many more

In this blog we want to talk about what might be the absolute easiest way to take workloads running on virtual machines and migrate them to Kubernetes. 

By leveraging the latest version of Migrate for GKE, customers can move an application from any one of several different VM platforms to GKE Autopilot. In this scenario customers benefit from both an automated migration process and a managed Kubernetes cluster. The combination of these two technologies drastically reduce manual processes associated with modernizing and hosting your legacy applications. 

What is GKE Autopilot

GKE Autopilot is a mode of operation for GKE clusters that drastically reduces the amount of management overhead associated with running a Kubernetes cluster. 

Creating a GKE Autopilot cluster requires just a few clicks. The resulting cluster is pre-configured with an optimized configuration that is ready for production workloads. This streamlined configuration follows GKE best practices and recommendations for cluster and workload setup and security

Once the cluster is deployed, much of the ongoing management is offloaded to Google Cloud. For instance, you no longer have to worry about scaling your worker nodes to handle increased demand. GKE Autopilot will automatically scale as needed, but you only pay for the actual resources, memory and CPU, you consume. In contrast, under a standard mode GKE Cluster you pay for the nodes you’ve provisioned, regardless of actual utilization. 

To learn more about GKE Autopilot check out the documentation or watch this video.

What is Migrate for Anthos and GKE

Migrate for Anthos and GKE is a free tool from Google Cloud that automates the migration of workloads from virtual machines to Kubernetes. The source VMs can be running on-prem on VMWare, or on AWS, Azure or Google Cloud. 

In order to ensure that you’re targeting the right workloads, Migrate for GKE includes a fit assessment tool that will examine a given VM and produce a report on whether or not the application is a good candidate for migration. You can read more about planning best practices in our documentation. 

Migrate for GKE will automatically examine your VMs and extract the core components necessary to run the application. After examining the VM, Migrate will produce a Dockerfile, Docker image, and a Kubernetes deployment YAML so you can seamlessly deploy your application. 

For more information on the core capabilities of Migrate for Anthos and GKE check out this overview video.

Using GKE Autopilot and Migrate for GKE together

With the release of Migrate for Anthos and GKE 1.8 a new feature was released via public preview to produce containers that don’t require elevated privileges, allowing those containers to be deployed on GKE Autopilot clusters. And, best of all, it only requires a single line in the migration YAML file to enable this new feature. 

Once you’ve created your migration plan, all you need to do is set  v2kServiceManager to true under the spec section.

For example:

  apiVersion: anthos-migrate.cloud.google.com/v1beta2
kind: GenerateArtifactsFlow
metadata:
  name: generate-artifacts-flow-f482c9f9-4964-885e-ef3e4eeb6d63
  namespace: v2k-system
spec:
  v2kServiceManager: true

By setting the v2kServiceManager variable, your resulting container can be deployed without further modification to GKE Autopilot. Not only that, but that same container could be deployed to Cloud Run as well. And, of course, it would also work on standard mode GKE clusters. 

If you’d like to see a demo of Migrate for Anthos and GKE working with GKE Autopilot, check out the following video.