Stay organized with collections Save and categorize content based on your preferences.
The
Migrate to Containersintegration with
Cloud Codegives you the ability to modernize Linux application components that run on virtual machines (VMs), and generate artifacts that can be deployed to
Google Kubernetes Engineand
Cloud Run, directly in your IDE, using a Linux machine.
In this guide, you learn how to replatform an existing application to a GKE container using the Cloud Code extension in your IDE on a Linux machine.
This guide is intended for developers on a Linux machine that have working knowledge of VS Code, are familiar with Google Cloud, and have a VM running their application component.
Note: To perform the steps in this guide, you must use a Linux machine. Cloud Code doesn't support replatforming applications to containers using Windows or macOS. Before you beginIn the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Verify that billing is enabled for your Google Cloud project.
Enable the Google Kubernetes Engine API.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Verify that billing is enabled for your Google Cloud project.
Enable the Google Kubernetes Engine API.
In this section, you install the Migration Center discovery client CLI (mcdc
) and other Migrate to Containers tools on your local machine, if you haven't already, and add a replatform source by following these steps:
In the activity bar of your IDE, click Cloud Code, and then expand the Replatform Apps explorer.
If this is your first time using Migrate to Containers in Cloud Code, you'll need to install the mcdc
CLI and other Migrate to Containers tools on your local machine by clicking Install tools. Otherwise, proceed to the next step.
Click Edit Sources. This opens an empty mcdc-sources.json
file. Add your sources in the following format:
[
{
"title": "SOURCE_NAME",
"host": "HOSTNAME",
"user": "USER",
"identityFile":"IDENTITY-FILE-PATH"
}
]
Note: You can use the same host
, user
, and identityFile
variables in an SSH command.To see the sources appear in the Replatform Apps explorer, hold your pointer over the Replatform Apps explorer and click the cached Reload sources button that appears.
Before attempting to replatform your application to a container, we recommend that you generate a Fit Assessment of your source, which notifies you if your source is capable of replatforming a container.
To generate a Fit Assessment of your source, right-click your source and select Assess source. This opens the terminal in your IDE and displays the logs of your source's assessment.
When the assessment is complete, mcdc
generates a Fit Assessment Report in your IDE.
If your sources are reported to be a Good Fit, then you're ready to replatform your application.
Replatform your applicationCloud Code creates a dedicated workspace for each replatform and lets you run the Copy, Analyze, and Generate tasks in the workspace to automate the replatform steps. If you run the Generate task without running the Copy and Analyze tasks first, it automatically runs them before generating artifacts.
The following sections guide you through performing each of these tasks and replatforming your application to a container using Cloud Code.
To learn more about the lifecycle of a migration, see Migrate to Containers CLI architecture.
Create a new replatform workspaceBefore you create a new replatform workspace, you'll need to know which migration parameters to select for your migration type. For more information about the parameters for each migration type, see Create a migration plan.
To create a new replatform workspace with artifacts in your IDE, follow these steps:
In the Replatform Apps explorer, right-click the source you want to replatform and then click Replatform.
From the list of options that appear in the menu, select a replatform journey.
Select a new workspace directory to replatform your application in, click OK, and then click Create replatform workspace.
Select the migration parameters for your migration type.
Optional: If you selected the WebSphere migration type and want to use a binary scanner, select the binaryAppScanner.jar
file.
The workspace generation takes a few seconds. This opens your new workspace directory in a new window of your IDE.
To copy the files from your VM to your workspace in your IDE, perform the following steps:
Optional: The mcdc
CLI applies filters to reduce the size of the copy, but you can modify the filters.txt
file to further reduce the size of the copy. To learn how to reduce the size of the copy, see Reduce the size of the copied file system.
Open the command palette by pressing Ctrl+Shift+P.
Search for and select Tasks: Run Task, and then select m2c: Copy. Copying files may take a few minutes.
To analyze the VM file system and generate a migration plan, perform the following steps:
Open the command palette by pressing Ctrl+Shift+P.
Search for and select Tasks: Run Task, and then select m2c: Analyze.
If the analyze task fails, you need to modify your migration parameters through the analyze-args.ini
file. This file has one line per parameter with accompanying documentation about the parameter.
When the analysis succeeds, Cloud Code creates a directory called migration-plan
which contains the results of the analysis in the form of a config.yaml
file. You can edit this file to change the way your artifacts are generated.
The structure of your config.yaml
file differs based on your migration type. For more information about the supported migration types, see the following pages:
To generate artifacts, you need to run the Generate task in your IDE. If you didn't already run the Copy and Analyze tasks in the previous sections, the Generate task automatically runs them both before generating artifacts.
To generate the artifacts, perform the following steps:
Open the command palette by pressing Ctrl+Shift+P.
Search for and select Tasks: Run Task, and then select m2c: Generate. This generates the artifacts in the src
directory, which contains a skaffold.yaml
file that is used to build and deploy a container image. Each migration type generates different artifacts, but all migration types usually create one or more dockerfiles and a GKE deployment spec that skaffold.yaml
references.
When artifact generation is complete, you're finished replatforming your application!
Optional: If you want to modify the migration plan, edit your config.yaml
file and re-run the m2c: Generate task.
Otherwise, if you're satisfied with your replatform results, you can proceed to run your application in a GKE container.
In this section, you run your replatformed application in a GKE container, view your running application's logs, and clean up resources.
If you haven't already created and configured a GKE cluster, follow the instructions in Create and configure a GKE cluster in Cloud Code for VS Code.
To learn more about debugging GKE applications, see Debug Kubernetes applications with Cloud Code for VS Code.
Run and view your applicationNow that you're all set up, you can run your application and view it live. Cloud Code watches your file system for changes so that you can edit and rerun your app in real time.
To run your application, follow these steps:
In the Cloud Code status bar, click the active project name.
In the Quick Pick menu that appears, select Run on Kubernetes.
Confirm whether to use the current cluster context or switch to a different one.
If prompted, choose an image registry to push the images to. If you're creating a new image registry using gcr.io/PROJECT_ID
, ensure that the image registry is in the same project as your cluster.
An output window appears where you can track the progress of your running application. You'll also see a livestream of the logs from the running pods in the terminal output.
After your application is running on Kubernetes, the output window displays an IP address. To use this linked IP address to access your application, press Ctrl and click the address.
After your debugging session starts, the Development sessions pane displays the structured logging view. As a task begins, the task appears with a spinning semi-circle progress_activity.
If a task succeeds, a check mark check_circle appears next to the step.
To see details of a step, click the step in the Development session pane. The Output pane displays the step in the logging output.
Clean upAfter you stop your application, all Kubernetes resources deployed during the run are deleted automatically.
To avoid incurring charges to your account for other resources used in this quickstart, be sure to delete the project or delete the cluster you created if you want to reuse the project.
To delete the cluster:
To delete your project (and associated resources, including any clusters):
appspot.com
URL, delete selected resources inside the project instead of deleting the whole project.If you plan to explore multiple architectures, tutorials, or quickstarts, reusing projects can help you avoid exceeding project quota limits.
To delete all local files that were created during the replatform process:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This guide demonstrates how to use Cloud Code on a Linux machine to modernize Linux applications running on virtual machines (VMs) and deploy them as containers to Google Kubernetes Engine (GKE) or Cloud Run."],["The process involves installing Migrate to Containers tools, adding a replatform source to represent your VM, and optionally generating a Fit Assessment to determine the suitability of your source for containerization."],["You can create a dedicated replatform workspace in Cloud Code, which includes tasks to copy files from your VM, analyze the file system to create a migration plan, and generate the artifacts needed for container deployment."],["After artifact generation, you can run your application in a GKE container directly from Cloud Code, viewing live logs and utilizing real-time editing capabilities."],["The guide also covers cleanup procedures, including deleting Kubernetes resources, the GKE cluster, the project, and the local files created during the replatforming process."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4