Dalam panduan ini, Anda akan mempelajari cara memindahkan platform aplikasi yang ada ke container GKE menggunakan ekstensi Cloud Code di IDE Anda di mesin Linux.
Panduan ini ditujukan bagi developer di mesin Linux yang memiliki pengetahuan tentang VS Code, memahami Google Cloud, dan memiliki VM yang menjalankan komponen aplikasi mereka.
Sebelum memulai
- Login ke akun Google Cloud Anda. Jika Anda baru menggunakan Google Cloud, buat akun untuk mengevaluasi performa produk kami dalam skenario dunia nyata. Pelanggan baru juga mendapatkan kredit gratis senilai $300 untuk menjalankan, menguji, dan men-deploy workload.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Google Kubernetes Engine API, if it is not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Google Kubernetes Engine API, if it is not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.- Instal ekstensi Cloud Code jika Anda belum melakukannya.
- Buat dan konfigurasi cluster GKE.
- Pastikan Anda mengetahui jenis migrasi yang ingin Anda lakukan. Untuk mengetahui informasi selengkapnya tentang workload yang didukung, lihat Meninjau OS, workload, dan versi Kubernetes yang kompatibel.
- Siapkan komputer sumber dan lokal untuk modernisasi. Cloud Code hanya mendukung Linux untuk modernisasi.
Menambahkan sumber platform ulang
Di bagian ini, Anda akan menginstal CLI discovery client Migration Center (mcdc) dan alat Migrate to Containers lainnya di komputer lokal, jika belum melakukannya, dan menambahkan sumber replatform dengan mengikuti langkah-langkah berikut:
Di panel aktivitas IDE, klik
Cloud Code, lalu luaskan explorer Replatform Apps.
Jika ini pertama kalinya Anda menggunakan Migrate to Containers di Cloud Code, Anda harus menginstal CLI
mcdcdan alat Migrate to Containers lainnya di mesin lokal dengan mengklik Install tools. Jika tidak, lanjutkan ke langkah berikutnya.Klik Edit Sumber. Tindakan ini akan membuka file
mcdc-sources.jsonkosong. Tambahkan sumber Anda dalam format berikut:[ { "title": "SOURCE_NAME", "host": "HOSTNAME", "user": "USER", "identityFile":"IDENTITY-FILE-PATH" } ]Untuk melihat sumber muncul di penjelajah Replatform Apps, arahkan kursor ke penjelajah Replatform Apps, lalu klik tombol Muat ulang sumber