從叢集解除安裝 Knative serving「GKE 外掛程式」,包括相關資源和標籤。
在這項工作中,遷移指令碼只會從叢集移除「GKE 外掛程式」,所有現有的 Knative serving 資源都會保留在叢集中,並繼續提供流量。
事前準備
總覽
解除安裝 GKE 外掛程式包括:
- 確認節點集區符合升級需求。
- 套用遷移標籤並建立許可 Webhook
ValidatingWebhookConfiguration,防止 Knative Serving 資源在下列命名空間中遭到刪除:knative-servingcloud-run-systemgke-system
解除安裝「GKE 外掛程式」,包括從 Knative Serving 資源中移除相關的管理員標籤。
請注意,這項程序可能需要超過 10 分鐘才能完成。
新增
appdevexperience-operator註解。移除未與機群搭配使用的過時
cloudrun.operator.run.cloud.google.com資源。
解除安裝 Knative serving GKE 外掛程式
在本節中,您將使用遷移指令碼解除安裝「GKE 外掛程式」。
執行下列指令,啟動遷移指令碼:
./migration-addon.sh --command uninstall-cloudrun-addon在終端機中,遷移指令碼會提示您確認執行每項動作。輸入
y即可開始程序,並在每個提示繼續。解除安裝「GKE 外掛程式」時,系統會顯示類似下方的提示:
In this process, the script performs the following: 1. Validating the node pool to make sure it meets the requirements for upgrading. Confirming node pool requirements for my-gcp-project/us-central1-c/my-gke-cluster... 2. Applying the required migration labels namespace/knative-serving labeled 3. Create a ValidatingWebhookConfiguration admission webhook to prevent the deletion of resources under the following namespaces: knative-serving, cloud-run-system, and gke-system Continue? [Y/n] y validatingwebhookconfiguration.admissionregistration.k8s.io/prevent-deletion-cloud-run-resources created ValidatingWebhookConfiguration prevent-deletion-cloud-run-resources for preventing deleting Knative serving resources is effective. 4. Uninstall the Knative serving GKE add-on? Your Knative serving resources remain in your cluster. Continue? [Y/n] y Updating my-gke-cluster... 5. Removing the add-on manager labels and adding the Operator related annotations. This step will take about 10 minutes. customresourcedefinition.apiextensions.k8s.io/certificates.networking.internal.knative.dev annotated 6. Clean up unused stale Knative serving operator. cloudrun.operator.run.cloud.google.com "cloud-run" deleted No resources found Knative serving GKE add-on is successfully uninstalled.執行下列指令,確認「GKE add-on」(GKE 外掛程式) 已
disabled:gcloud container clusters describe ${CLUSTER_NAME} --region ${CLUSTER_LOCATION} --project ${PROJECT_ID} --format='get(addonsConfig.cloudRunConfig.disabled)'如果成功從叢集移除「GKE 外掛程式」,系統會傳回
True。
後續步驟
復原
如要復原透過上述步驟所做的變更,您可以使用遷移指令碼執行下列操作:
- 重新啟用 Knative serving「GKE 外掛程式」。
- 移除
ValidatingWebhookConfiguration准入 Webhook。
如要開始復原程序,請按照下列步驟操作:
執行下列指令,啟動遷移指令碼:
./migration-addon.sh --command rollback-uninstall-cloudrun-addon在終端機中,遷移指令碼會提示您確認執行每項動作。在每個提示中輸入
y即可繼續。重新啟用「GKE 外掛程式」時,系統會顯示類似下方的提示:
In this step, the script performs the following: 1. Enable Knative serving GKE add-on 2. Remove the ValidatingWebhookConfiguration added for uninstalling addon Continue? [Y/n] Y 1. Enable Knative serving GKE add-on? Continue? [Y/n] Y Updating my-gke-cluster...done. Knative serving GKE add-on is enabled 2. Remove the ValidatingWebhookConfiguration added for uninstalling addon? Continue? [Y/n] Y Removing the ValidatingWebhookConfiguration used to prevent deletion確認 Knative serving「GKE 外掛程式」已重新啟用:
gcloud container clusters describe ${CLUSTER_NAME} --region ${CLUSTER_LOCATION} --project ${PROJECT_ID} --format='get(addonsConfig.cloudRunConfig)'如果外掛程式在叢集中執行,系統會傳回外掛程式的設定詳細資料。範例:
loadBalancerType=LOAD_BALANCER_TYPE_EXTERNAL