Knative Serving GKE アドオンをアンインストールする

Knative serving「GKE アドオン」(関連するリソースとラベルを含む)をクラスタからアンインストールします。

このタスクでは、移行スクリプトを使用してクラスタから「GKE アドオン」のみをクラスタから削除します。既存のすべての Knative serving リソースはクラスタに残り、トラフィックの処理を続行します。

始める前に

概要

GKE アドオンをアンインストールします。

  1. ノードプールがアップグレードの要件を満たしていることを確認します。
  2. 移行ラベルを適用してアドミッション Webhook ValidatingWebhookConfiguration を作成し、次の名前空間で Knative serving リソースが削除されないようにします。
    • knative-serving
    • cloud-run-system
    • gke-system
  3. 「GKE アドオン」をアンインストールします(Knative serving リソースから関連するマネージャー ラベルを削除するなど)。

    このプロセスは 10 分以上実行されることがあります。

  4. appdevexperience-operator アノテーションを追加する。

  5. フリートで使用されていない古い cloudrun.operator.run.cloud.google.com リソースを削除する。

Knative Serving GKE アドオンをアンインストールする

このセクションでは、移行スクリプトを使用して「GKE アドオン」をアンインストールします。

  1. 次のコマンドを実行して、移行スクリプトを開始します。

    ./migration-addon.sh --command uninstall-cloudrun-addon
    
  2. ターミナルには、移行スクリプトによって、各アクションの実行を確認するメッセージが表示されます。「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.
    
  3. 次のコマンドを実行して、「GKE アドオン」が disabled であることを確認します。

    gcloud container clusters describe ${CLUSTER_NAME} --region ${CLUSTER_LOCATION} --project ${PROJECT_ID} --format='get(addonsConfig.cloudRunConfig.disabled)'
    

    「GKE アドオン」がクラスタから正常に削除された場合、True が返されます。

次のステップ

Anthos Service Mesh に移行する

ロールバック

上記手順での変更をロールバックする必要がある場合は、移行スクリプトを使用して次のことを行えます。

  • Knative serving「GKE アドオン」を再度有効にします。
  • ValidatingWebhookConfiguration アドミッション Webhook を削除します。

ロールバック処理を開始するには:

  1. 次のコマンドを実行して、移行スクリプトを開始します。

    ./migration-addon.sh --command rollback-uninstall-cloudrun-addon
    
  2. ターミナルには、移行スクリプトによって、各アクションの実行を確認するメッセージが表示されます。入力を求める各メッセージには、「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
    
  3. Knative serving の「GKE アドオン」が再び有効になっていることを確認します。

    gcloud container clusters describe ${CLUSTER_NAME} --region ${CLUSTER_LOCATION} --project ${PROJECT_ID} --format='get(addonsConfig.cloudRunConfig)'
    

    アドオンがクラスタで実行されている場合は、アドオンの構成の詳細が返されます。例:

    loadBalancerType=LOAD_BALANCER_TYPE_EXTERNAL