Melakukan replatforming aplikasi Linux ke penampung

Integrasi Migrate to Containers dengan Cloud Code memberi Anda kemampuan untuk memodernisasi komponen aplikasi Linux yang berjalan di virtual machine (VM), dan membuat artefak yang dapat di-deploy ke Google Kubernetes Engine dan Cloud Run, langsung di IDE Anda, menggunakan mesin Linux.

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

  1. 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.
  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. 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.enable permission. 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.

    Enable the API

  5. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. 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.enable permission. 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.

    Enable the API

  8. Instal ekstensi Cloud Code jika Anda belum melakukannya.
  9. Buat dan konfigurasi cluster GKE.
  10. 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.
  11. 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:

  1. Di panel aktivitas IDE, klik Cloud Code, lalu luaskan explorer Replatform Apps.

  2. Jika ini pertama kalinya Anda menggunakan Migrate to Containers di Cloud Code, Anda harus menginstal CLI mcdc dan alat Migrate to Containers lainnya di mesin lokal dengan mengklik Install tools. Jika tidak, lanjutkan ke langkah berikutnya.

  3. Klik Edit Sumber. Tindakan ini akan membuka file mcdc-sources.json kosong. Tambahkan sumber Anda dalam format berikut:

    [
      {
        "title": "SOURCE_NAME",
        "host": "HOSTNAME",
        "user": "USER",
        "identityFile":"IDENTITY-FILE-PATH"
      }
    ]
    
  4. Untuk melihat sumber muncul di penjelajah Replatform Apps, arahkan kursor ke penjelajah Replatform Apps, lalu klik tombol Muat ulang sumber