Configuração e preparação do ambiente para upgrade
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Prepare-se para fazer upgrade da instalação anterior do Knative serving e migre
as cargas de trabalho configurando o ambiente de linha de comando, criando variáveis de ambiente
e fazendo o download do script de migração.
Antes de começar
Primeiro, revise e verifique se você atende aos requisitos antes de fazer upgrade.
Por padrão, o Cloud Shell inclui as versões mais recentes dos comandos gcloud e kubectl. Se você optar por usar o ambiente de linha de comando da sua
máquina local, será preciso atender aos seguintes requisitos mínimos:
Importante: todos os comandos usados durante o processo dependem das
variáveis de ambiente definidas abaixo. Por exemplo, se você fechar o Cloud Shell ou o tempo limite da sessão expirar, verifique se as variáveis de ambiente necessárias são redefinidas.
Configure o ambiente.
Para usar o Cloud Shell, abra o Cloud Shell no Console do Google Cloud:
Importante: o Cloud Shell tem
limites de uso e pode atingir o tempo limite. Se o tempo limite da sessão expirar, verifique se as variáveis de ambiente necessárias são redefinidas.
Crie as seguintes variáveis de ambiente necessárias:
Defina variáveis para os detalhes do cluster e do projeto do Google Cloud:
CLUSTER_NAME pelo ID do cluster ou pelo identificador totalmente
qualificado do cluster.
CLUSTER_LOCATION pela
região ou zona em que o
cluster está localizado.
Dependendo da configuração, identifique o gateway de entrada
que está processando o tráfego no cluster. É importante identificar qual versão do Istio está realmente configurada e exibindo o tráfego.
Se você usar a versão empacotada do Istio, verifique se o nome
do serviço de entrada é istio-ingress no namespace gke-system:
kubectlgetsvcistio-ingress-ngke-system
Resultado: os detalhes da configuração são retornados.
Se você instalou o
complemento do Istio, é necessário
determinar qual gateway de entrada está configurado e processar ativamente
o tráfego recebendo o IP. Endereços dos serviços e identificando qual deles está configurado para seu domínio.
Consiga o endereço EXTERNAL-IP de cada serviço de entrada:
Execute os seguintes comandos para receber os detalhes de configuração dos
serviços de entrada "pacotes do Istio" (istio-ingress) e
"complemento do Istio" (istio-ingressgateway):
Clique no ícone de três pontos à direita do serviço e,
em seguida, clique em REGISTROS DNS para exibir todos os registros:
Usando o exemplo acima, o gateway de entrada do complemento do Istio está em uso e veiculando o tráfego se a configuração do registro DNS estiver definida como o endereço IP 10.987.654.321 do
}istio-ingressgateway.
Defina variáveis para o nome e namespace do serviço de entrada que está veiculando tráfego para o cluster:
Se você já tiver acesso ao cluster particular a partir do cliente em que
executará o script de migração, pule para a
próxima etapa.
Se o cluster particular tiver master-authorized-network ativado, será possível ativar o acesso no cliente em que o script de migração será executado adicionando o endereço IP do cliente à lista de permissões master-authorized-networks.
Execute o seguinte comando para desativar o "escalonamento para zero". Caso contrário, o escalonamento falhará e causará erros quando o nó mestre for atualizado:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2024-11-21 UTC."],[],[],null,["# Environment setup and preparation for upgrading\n\nPrepare to upgrade your previous installation of Knative serving and migrate\nyour workloads by setting up your command-line environment, creating environment\nvariables, and downloading the migration script.\n\nBefore you begin\n----------------\n\n- You must first review and ensure that you meet the\n [requirements](/kubernetes-engine/enterprise/knative-serving/docs/install/on-gcp/upgrade) before upgrading.\n\n- By default, Cloud Shell includes the latest versions of the `gcloud` and\n `kubectl` commands. If you choose to use the command-line environment of your\n local machine, you must ensure that you meet the following minimum\n requirements:\n\n - `gcloud` version 346.0.0 or newer\n - `kubectl` client version 1.21 or newer\n\n [Learn more about setting up your command-line tools](/kubernetes-engine/enterprise/knative-serving/docs/install/on-gcp/command-line-tools)\n- The preparation steps on this page are required throughout the\n [upgrade and migration process](/kubernetes-engine/enterprise/knative-serving/docs/install/on-gcp/upgrade).\n\n **Important**: All the commands that are used during the process rely on the\n environment variables that you set below. For example, if you close\n Cloud Shell or your session timesout, you must ensure that the required\n environment variables are reset.\n\nSetup your environment\n----------------------\n\n1. To use Cloud Shell, open Cloud Shell in the Google Cloud console:\n\n [Activate Cloud Shell](https://console.cloud.google.com/kubernetes/run?cloudshell=true%22)\n\n **Important** : Cloud Shell has\n [usage limits](/shell/docs/limitations#usage_limits) and can timeout. If your\n session timesout, you must ensure that the required environment variables\n are reset.\n2. Create the following required environment variables:\n\n 1. Set variables for your Google Cloud project and cluster details:\n\n export PROJECT_ID=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n export CLUSTER_NAME=\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\n export CLUSTER_LOCATION=\u003cvar translate=\"no\"\u003eCLUSTER_LOCATION\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the ID of your Google Cloud project.\n - \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e with the ID of your cluster or the fully qualified identifier for the cluster.\n - \u003cvar translate=\"no\"\u003eCLUSTER_LOCATION\u003c/var\u003e with the [region or zone](/compute/docs/regions-zones#available) in which your cluster is located.\n 2. Depending on your configuration, you must identify the ingress gateway\n that is handling traffic in your cluster. It is important to identify\n which version of Istio is actually configured and serving traffic.\n\n - If you use the bundled version of Istio, verify that the ingress\n service name is `istio-ingress` in the `gke-system` namespace:\n\n kubectl get svc istio-ingress -n gke-system\n\n Result: The details of your configuration are returned.\n - If you installed the\n \"[*Istio add-on*](/istio/docs/istio-on-gke/overview)\", you must\n determine which ingress gateway is configured and actively handling\n traffic by obtaining the IP addresses of the services and identifying\n which one is configured to your domain.\n\n 1. Obtain the `EXTERNAL-IP` address for each ingress service:\n\n Run the following commands to obtain the configuration details of\n both the \"bundled version of Istio\" (`istio-ingress`) and\n \"Istio add-on\" (`istio-ingressgateway`) ingress services: \n\n kubectl get svc istio-ingress -n gke-system\n kubectl get svc istio-ingressgateway -n istio-system\n\n **Example output**:\n\n Note the value of `EXTERNAL-IP` for each service. \n\n NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n istio-ingress LoadBalancer 11.11.1.111 12.345.678.910 15020:31265/TCP,80:30059/TCP,443:32004/TCP 8d\n\n NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n istio-ingressgateway LoadBalancer 22.22.2.222 10.987.654.321 15021:32747/TCP,80:30695/TCP,443:32695/TCP,15012:32369/TCP,15443:30909/TCP 88d\n\n 2. Identify which external IP address is configured to handle\n traffic through the DNS record of your custom domain:\n\n 1. Go to the Knative serving domain mappings page:\n\n [Go to Domain mappings](https://console.cloud.google.com/kubernetes/run/domains)\n 2. Click the 3-dot vertical ellipse icon to the right of your\n service, then click **DNS RECORDS** to display all the DNS\n records:\n\n Using the example above, the *Istio add-on* ingress gateway is\n in use and serving traffic if the DNS record configuration is\n set to the `10.987.654.321` IP address of the\n `istio-ingressgateway` service.\n 3. Set variables for the name and namespace of the ingress service that is\n serving traffic for your cluster:\n\n export INGRESS_NAME=\u003cvar translate=\"no\"\u003eINGRESS_NAME\u003c/var\u003e\n export INGRESS_NAMESPACE=\u003cvar translate=\"no\"\u003eINGRESS_NAMESPACE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eINGRESS_NAME\u003c/var\u003e with the name of the ingress service that\n you identified in the previous step.\n\n - \u003cvar translate=\"no\"\u003eINGRESS_NAMESPACE\u003c/var\u003e with the namespace of the ingress\n service that you identified in the previous step.\n\n3. Configure the Google Cloud CLI:\n\n gcloud config set project ${PROJECT_ID}\n gcloud container clusters get-credentials ${CLUSTER_NAME} --region ${CLUSTER_LOCATION}\n\n4. For private clusters:\n\n - If you already have access to your private cluster from the client where\n you will run the migration script, you can skip to the\n next step.\n\n - If your private cluster has `master-authorized-network` enabled, you can\n enable access from the client where you will run the migration script by\n adding the client's IP address to the `master-authorized-networks`\n allowlist:\n\n gcloud container clusters update ${CLUSTER_NAME} \\\n --region=${CLUSTER_LOCATION} \\\n --enable-master-authorized-networks \\\n --master-authorized-networks $(curl ifconfig.me)/32\n\n5. Download the Knative serving migration script:\n\n TMP_DIR=$(mktemp -d)\n gcloud storage cp gs://crfa-to-hub-upgrade/migration-addon.sh $TMP_DIR\n cd $TMP_DIR\n chmod +x ./migration-addon.sh\n\n6. Run the following command to disable \"scaling to zero\", otherwise\n scaling will fail and cause errors when the master node gets updated:\n\n kubectl patch cm config-autoscaler -n knative-serving -p '{\"data\":{\"enable-scale-to-zero\": \"false\"}}'\n\n Note that the final step in this upgrade and migration process is to\n re-enable \"scaling to zero\".\n\nWhat's next\n-----------\n\n[Uninstall the GKE addon](/kubernetes-engine/enterprise/knative-serving/docs/install/on-gcp/upgrade/uninstall-addon)."]]