Installa il componente del parco risorse Cloud Run for Anthos

Installa Cloud Run for Anthos come componente del parco risorse GKE Enterprise.

Prima di iniziare

Panoramica

L'installazione di Cloud Run for Anthos come componente del parco risorse include:

  1. Abilitazione dei parchi risorse nel tuo progetto Google Cloud.
  2. Copia del gateway gke-system-gateway nel gateway knative-ingress-gateway.
  3. Installazione della risorsa personalizzata Cloud Run for Anthos nel cluster.

Tieni presente che durante questo processo i servizi Cloud Run for Anthos esistenti continuano a gestire il traffico senza interruzioni.

Installa il componente del parco risorse Cloud Run for Anthos

In questa sezione, lo script di migrazione viene utilizzato per installare Cloud Run for Anthos come componente del parco risorse.

  1. Esegui questo comando per avviare lo script di migrazione:

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

    Tieni presente che se hai problemi con questo passaggio o se vuoi apportare delle modifiche, puoi eseguire nuovamente questo comando dello script di migrazione.

  2. Nel terminale, lo script di migrazione richiede la conferma per eseguire ogni azione. Per continuare, inserisci y a ogni richiesta.

    I prompt durante il processo di installazione del componente del parco risorse Cloud Run for Anthos sono simili ai seguenti:

    In the process of installing the Cloud Run for Anthos 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 Cloud Run for Anthos 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 Cloud Run for Anthos custom resource in your cluster?
    Continue? [Y/n] y
    
    Waiting for Cloud Run for Anthos feature to be enabled
    Cloud Run for Anthos 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 Cloud Run for Anthos
    
    Waiting for Cloud Run for Anthos serving to be ready...
    Cloud Run for Anthos serving is not ready yet.
    Cloud Run for Anthos serving is ready.
    
    Removing the ValidatingWebhookConfiguration used to prevent deletion
    validatingwebhookconfiguration.admissionregistration.k8s.io
    "prevent-deletion-cloud-run-resources" deleted
    
    Cloud Run for Anthos has been installed as an Anthos fleet component
    

    Problema noto per i cluster privati

    Se l'installazione di Cloud Run for Anthos è su un cluster privato su Google Cloud, potresti ricevere un errore di timeout da:

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

    Per evitare l'errore di timeout, esegui questo comando:

    cat <<EOF | kubectl apply -f -
    apiVersion: operator.run.cloud.google.com/v1alpha1
    kind: CloudRun
    metadata:
      name: cloud-run
    EOF
    
  3. Verifica che il componente della funzionalità Cloud Run for Anthos sia abilitato:

    Console

    Verifica se il componente Cloud Run for Anthos è abilitato nella console Google Cloud:

    Vai alle funzionalità di GKE Enterprise

    pagina delle funzionalità

    Riga di comando

    Visualizza se lo stato di appdevexperience è ACTIVE:

    gcloud alpha container hub features list  --project=PROJECT_ID
    

    Sostituisci PROJECT_ID con l'ID del tuo progetto Google Cloud.

    Per dettagli e opzioni aggiuntive, consulta la documentazione di riferimento gcloud alpha container hub feature list.

Passaggi successivi

Ora che Anthos Service Mesh e Cloud Run for Anthos sono installati, puoi iniziare a eseguire la migrazione e l'implementazione del traffico nelle nuove risorse.

Esegui il rollback

Se devi eseguire il rollback delle modifiche apportate tramite i passaggi precedenti, puoi utilizzare lo script di migrazione per:

  • Rimuovi il controllo delle risorse Cloud Run for Anthos dall'operatore appdevexperience-operator.
  • Elimina la risorsa personalizzata Cloud Run for Anthos e disinstalla l'operatore appdevexperience-operator.
  • (Facoltativo) Disabilita Cloud Run for Anthos nel parco risorse del tuo progetto Google Cloud.

Per avviare il processo di rollback:

  1. Esegui questo comando per avviare lo script di migrazione:

    ./migration-addon.sh --command rollback-install-cloud-run-v2
    
  2. Nel terminale, lo script di migrazione richiede la conferma per eseguire ogni azione. Per continuare, inserisci y in a ogni richiesta.

    Le richieste durante la disinstallazione del componente del parco risorse sono simili alle seguenti:

    In the step of rolling back the Cloud Run for Anthos fleet installation, the
    script performs the following:
    1. Remove control of Cloud Run for Anthos resources from the operator
       `appdevexperience-operator`.
    2. Delete the Cloud Run for Anthos custom resource and uninstall the operator
       `appdevexperience-operator`.
    3. Revert the changes installed by the Cloud Run for Anthos fleet component.
    4. Optional: Disable Cloud Run for Anthos in the GKE Enterprise fleet of your
       Google Cloud project.
    Continue? [Y/n] y
    
    1. Removing control of Cloud Run for Anthos 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 Cloud Run for Anthos resources to be deleted
    
    OwnerReferences of Cloud Run for Anthos resources are deleted
    
    Waiting for Cloud Run for Anthos serving to be ready...
    Cloud Run for Anthos serving is ready.
    
    2. Delete the Cloud Run for Anthos 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 Cloud Run for Anthos 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
       Cloud Run for Anthos fleet component enabled because it was enabled prior to
       this migration.
    Continue (or Skip)? [Y/n] n