Instala Knative como un componente de flota de GKE Enterprise.
Antes de comenzar
Primero, debes revisar y asegurarte de cumplir con los requisitos para actualizar.
En los comandos de esta página, se usan las variables de entorno y la secuencia de comandos de migración del paso de preparación de la actualización.
Es importante que realices cada paso de este proceso en el orden especificado.
Descripción general
La instalación de Knative como un componente de flota incluye lo siguiente:
- Habilita flotas en tu proyecto de Google Cloud.
- Copiar la puerta de enlace
gke-system-gateway
en la puerta de enlaceknative-ingress-gateway
. - Instala el recurso personalizado de entrega de Knative en tu clúster.
Ten en cuenta que, durante este proceso, los servicios de entrega de Knative existentes continúan recibiendo tráfico de servicio sin interrupciones.
Instala el componente de flota de servicio de Knative
En esta sección, la secuencia de comandos de migración se usa para instalar Knative como un componente de la flota.
Ejecuta el siguiente comando para iniciar la secuencia de comandos de migración:
./migration-addon.sh --command install-cloud-run-v2
Ten en cuenta que si tienes algún problema con este paso o quieres cambiar algo, puedes volver a ejecutar este comando de secuencia de comandos de migración.
En la terminal, la secuencia de comandos de migración te solicita tu confirmación para realizar cada acción. Ingresa
y
en cada mensaje para continuar.Los mensajes durante el proceso de instalación del componente de flota de servicio de Knative tienen un aspecto similar al siguiente:
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
Problema conocido para clústeres privados
Si la instalación de la entrega de Knative se encuentra en un clúster privado en Google Cloud, es posible que recibas un error de tiempo de espera de la siguiente manera:
Waiting for CRD cloudruns.operator.run.cloud.google.com to be created
Para solucionar el error de tiempo de espera, ejecuta el siguiente comando:
cat <<EOF | kubectl apply -f - apiVersion: operator.run.cloud.google.com/v1alpha1 kind: CloudRun metadata: name: cloud-run EOF
Verifica que el componente de función de entrega de Knative esté habilitado:
Console
Observa si el componente de entrega de Knative está Habilitado en la consola de Google Cloud:
Línea de comandos
Comprueba si el estado
appdevexperience
esACTIVE
:gcloud alpha container hub features list --project=PROJECT_ID
Reemplaza PROJECT_ID por el ID del proyecto de Google Cloud.
Para obtener detalles y opciones adicionales, consulta la referencia de lista funciones de gcloud alpha container hub.
¿Qué sigue?
Ahora que ya están instalados Anthos Service Mesh y la entrega de Knative, puedes comenzar a migrar e implementar el tráfico a tus recursos nuevos.
Revertir
Si necesitas revertir los cambios que realizaste en los pasos anteriores, puedes usar la secuencia de comandos de migración para lo siguiente:
- Quita el control de los recursos de entrega de Knative del operador
appdevexperience-operator
. - Borra el recurso personalizado de entrega de Knative y desinstala el operador
appdevexperience-operator
. - Opcional: Inhabilita la entrega de Knative en la flota de tu proyecto de Google Cloud.
Para comenzar el proceso de reversión, haz lo siguiente:
Ejecuta el siguiente comando para iniciar la secuencia de comandos de migración:
./migration-addon.sh --command rollback-install-cloud-run-v2
En la terminal, la secuencia de comandos de migración te solicita tu confirmación para realizar cada acción. Ingresa
y
en cada mensaje para continuar.Los mensajes durante el proceso de desinstalación del componente de flota son similares a los siguientes:
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