Installer le composant de parc Knative serving

Installer Knative serving en tant que composant de parc GKE Enterprise

Avant de commencer

Présentation

L'installation de Knative serving en tant que composant de parc comprend:

  1. Activer des parcs dans votre projet Google Cloud
  2. Copier la passerelle gke-system-gateway sur la passerelle knative-ingress-gateway.
  3. Installer la ressource personnalisée Knative serving dans votre cluster

Notez que pendant ce processus, vos services Knative serving existants continuent à diffuser le trafic sans interruption.

Installer le composant de parc Knative serving

Dans cette section, le script de migration est utilisé pour installer Knative serving en tant que composant de parc.

  1. Exécutez la commande suivante pour démarrer le script de migration :

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

    Notez que si vous rencontrez des problèmes lors de cette étape ou si vous souhaitez apporter une modification, vous pouvez réexécuter cette commande du script de migration.

  2. Dans le terminal, le script de migration vous invite à confirmer chaque opération. Saisissez y à chaque invite pour continuer.

    Les invites qui s'affichent lors du processus d'installation du composant du parc Knative serving se présentent comme suit:

    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
    

    Problème connu des clusters privés

    Si votre installation de Knative serving se trouve sur un cluster privé sur Google Cloud, vous pouvez recevoir une erreur d'expiration de délai de la manière suivante:

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

    Pour corriger cette erreur, exécutez la commande suivante :

    cat <<EOF | kubectl apply -f -
    apiVersion: operator.run.cloud.google.com/v1alpha1
    kind: CloudRun
    metadata:
      name: cloud-run
    EOF
    
  3. Vérifiez que le composant de fonctionnalité Knative serving est activé:

    Console

    Vérifiez si le composant Knative serving est activé dans la console Google Cloud:

    Accéder au gestionnaire de fonctionnalités

    Ligne de commande

    Vérifiez si l'état de appdevexperience est défini sur ACTIVE :

    gcloud alpha container hub features list  --project=PROJECT_ID
    

    Remplacez PROJECT_ID par l'ID de votre projet Google Cloud.

    Pour obtenir plus d'informations et découvrir des options supplémentaires, consultez la documentation de référence sur la liste des fonctionnalités de gcloud alpha container hub.

Étapes suivantes

Maintenant que Cloud Service Mesh et Knative serving sont installés, vous pouvez commencer à migrer et déployer le trafic vers vos nouvelles ressources.

Rollback

Si vous devez effectuer un rollback des modifications que vous avez apportées en suivant les étapes ci-dessus, vous pouvez utiliser le script de migration pour :

  • Supprimez le contrôle de vos ressources Knative serving à l'opérateur appdevexperience-operator.
  • Supprimez la ressource personnalisée Knative serving et désinstallez l'opérateur appdevexperience-operator.
  • Facultatif: désactivez Knative serving dans le parc de votre projet Google Cloud.

Pour lancer le processus de rollback, procédez comme suit :

  1. Exécutez la commande suivante pour démarrer le script de migration :

    ./migration-addon.sh --command rollback-install-cloud-run-v2
    
  2. Dans le terminal, le script de migration vous invite à confirmer chaque opération. Saisissez y à chaque invite pour continuer.

    Les invites liées au processus de désinstallation du composant de parc se présentent comme suit:

    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