Menginstal komponen inventaris penayangan Knative

Instal layanan Knative sebagai komponen fleet GKE Enterprise.

Sebelum memulai

Ringkasan

Menginstal Knative yang berfungsi sebagai komponen fleet mencakup:

  1. Mengaktifkan fleet di project Google Cloud Anda.
  2. Menyalin Gateway gke-system-gateway ke Gateway knative-ingress-gateway.
  3. Menginstal resource kustom penayangan Knative di cluster Anda.

Perhatikan bahwa selama proses ini, layanan penayangan Knative yang ada akan terus ke traffic layanan tanpa gangguan.

Menginstal komponen inventaris penayangan Knative

Di bagian ini, skrip migrasi digunakan untuk menginstal Knative yang berfungsi sebagai komponen fleet.

  1. Jalankan perintah berikut untuk memulai skrip migrasi:

    ./migration-addon.sh --command install-cloud-run-v2
    

    Perhatikan bahwa jika Anda memiliki masalah dengan langkah ini atau ingin mengubah sesuatu, Anda dapat menjalankan kembali perintah skrip migrasi ini.

  2. Di terminal, skrip migrasi akan meminta konfirmasi Anda untuk melakukan setiap tindakan. Masukkan y di setiap dialog untuk melanjutkan.

    Perintah selama proses penginstalan penayangan Knative komponen fleet terlihat mirip dengan berikut ini:

    In the process of installing the Knative serving fleet component, the
    script performs the following:
    1. Enabling the fleet in your Google Cloud project.
    2. Copy gke-system-gateway Gateway to knative-ingress-gateway Gateway
    3. Installing the Knative serving custom resource in your cluster.
    Continue? [Y/n] y
    
    1. Enabling Anthos services?
    Continue? [Y/n] y
    
    Operation "operations/acf.p2-625914735451-10d4b6ff-68e1-4a09-97c4-79b209be5031" finished successfully.
    
    2. Copying gke-system-gateway Gateway to knative-ingress-gateway Gateway
    
    configmap/original-knative-ingress-gateway-spec unchanged
    gateway.networking.istio.io/knative-ingress-gateway patched (no
    change)
    configmap/config-istio patched
    configmap/config-istio patched
    gateway.networking.istio.io "gke-system-gateway" deleted
    
    3. Install the Knative serving custom resource in your cluster?
    Continue? [Y/n] y
    
    Waiting for Knative serving feature to be enabled
    Knative serving feature is enabled.
    The YAML file for the new operator appdevexperience-operator was created at
    /tmp/tmp.bI7H1qagGa/cloudrun.yaml
    customresourcedefinition.apiextensions.k8s.io/cloudruns.operator.run.cloud.google.com
    condition met
    kubeconfig entry generated for my-gke-cluster.
    Added the custom resource for Knative serving
    
    Waiting for Knative serving serving to be ready...
    Knative serving serving is not ready yet.
    Knative serving serving is ready.
    
    Removing the ValidatingWebhookConfiguration used to prevent deletion
    validatingwebhookconfiguration.admissionregistration.k8s.io
    "prevent-deletion-cloud-run-resources" deleted
    
    Knative serving has been installed as an Anthos fleet component
    

    Masalah umum untuk cluster pribadi

    Jika penginstalan Knative Anda pada cluster pribadi di Google Cloud, Anda mungkin menerima error waktu tunggu dari:

    Waiting for CRD cloudruns.operator.run.cloud.google.com to be created
    

    Untuk mengatasi error waktu tunggu, jalankan perintah berikut:

    cat <<EOF | kubectl apply -f -
    apiVersion: operator.run.cloud.google.com/v1alpha1
    kind: CloudRun
    metadata:
      name: cloud-run
    EOF
    
  3. Memastikan bahwa komponen fitur penayangan Knative diaktifkan:

    Konsol

    Lihat apakah komponen penayangan Knative Diaktifkan di bagian Konsol Google Cloud:

    Buka Feature Manager

    Command line

    Lihat apakah status appdevexperience adalah ACTIVE:

    gcloud alpha container hub features list  --project=PROJECT_ID
    

    Ganti PROJECT_ID dengan ID project Google Cloud Anda.

    Untuk mengetahui detail dan opsi tambahan, lihat Daftar fitur hub container alpha gcloud alamat IP internal.

Langkah selanjutnya

Setelah Cloud Service Mesh dan Knative terinstal, Anda dapat mulai memigrasikan dan meluncurkan traffic ke resource baru.

Rollback

Jika Anda perlu melakukan rollback perubahan yang dibuat melalui langkah-langkah di atas, dapat menggunakan skrip migrasi untuk:

  • Menghapus kontrol resource penayangan Knative dari operator appdevexperience-operator.
  • Hapus resource kustom penayangan Knative dan uninstal operator appdevexperience-operator.
  • Opsional: Nonaktifkan penayangan Knative di perangkat project Google Cloud Anda.

Untuk memulai proses rollback:

  1. Jalankan perintah berikut untuk memulai skrip migrasi:

    ./migration-addon.sh --command rollback-install-cloud-run-v2
    
  2. Di terminal, skrip migrasi akan meminta konfirmasi Anda untuk melakukan setiap tindakan. Masukkan y ke setiap dialog untuk melanjutkan.

    Perintah selama proses meng-uninstal fleet komponen terlihat mirip dengan berikut ini:

    In the step of rolling back the Knative serving fleet installation, the
    script performs the following:
    1. Remove control of Knative serving resources from the operator
       `appdevexperience-operator`.
    2. Delete the Knative serving custom resource and uninstall the operator
       `appdevexperience-operator`.
    3. Revert the changes installed by the Knative serving fleet component.
    4. Optional: Disable Knative serving in the GKE Enterprise fleet of your
       Google Cloud project.
    Continue? [Y/n] y
    
    1. Removing control of Knative serving resources from the operator
       `appdevexperience-operator`.
    
    Creating a ValidatingWebhookConfiguration to prevent the deletion of the
    resources under the following namespaces:
    knative-serving, cloud-run-system, and gke-system
    
    waiting for OwnerReferences of Knative serving resources to be deleted
    
    OwnerReferences of Knative serving resources are deleted
    
    Waiting for Knative serving serving to be ready...
    Knative serving serving is ready.
    
    2. Delete the Knative serving custom resource and uninstall the operator
       `appdevexperience-operator`?
    Continue? [Y/n] y
    
    cloudrun.operator.run.cloud.google.com "cloud-run" deleted
    clusteractiveoperand.operand.run.cloud.google.com/sha256-3c1c80a329 patched
    
    waiting for appdevexperience namespace to be deleted
    
    3. Revert the changes installed by the fleet component?
    configmap/config-observability patched
    
    4. Optional: Disable Knative serving in the Anthos fleet of your
       Google Cloud project?
       You can choose to skip this step and keep the feature enable within your
       Anthos fleet. For example, you might want to keep the
       Knative serving fleet component enabled because it was enabled prior to
       this migration.
    Continue (or Skip)? [Y/n] n