Uninstall the Knative serving GKE add-on

Uninstall the Knative serving "GKE add-on" from your cluster, including related resources and labels.

In this task, the migration script is used to remove only the "GKE add-on" from your cluster, all of your existing Knative serving resources remain in your cluster and continue serving traffic.

Before you begin

Overview

Uninstalling the GKE add-on includes:

  1. Validating that the node pool meets the requirements for upgrading.
  2. Applying migration labels and creating the admission webhook ValidatingWebhookConfiguration to prevent your Knative serving resources from being deleted in the following namespaces:
    • knative-serving
    • cloud-run-system
    • gke-system
  3. Uninstalling the "GKE add-on", including removing the related manager labels from your Knative serving resources.

    Note that this process can run for more than 10 minutes.

  4. Adding the appdevexperience-operator annotations.

  5. Removing the stale cloudrun.operator.run.cloud.google.com resource that is not used with fleets.

Uninstall the Knative serving GKE add-on

In this section, the migration script is used to uninstall the "GKE add-on".

  1. Run the following command to start the migration script:

    ./migration-addon.sh --command uninstall-cloudrun-addon
    
  2. In the terminal, the migration script prompts you for your confirmation to perform each action. Enter y to begin the process and also to continue at each prompt.

    The prompts during the process of uninstalling the "GKE add-on" look similar to the following:

    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. Verify that the "GKE add-on" was disabled by running the following command:

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

    True is returned if the "GKE add-on" was successfully removed from your cluster.

What's next

Migrate to Cloud Service Mesh

Rollback

If you need to rollback the changes that you made through the steps above, you can use the migration script to:

  • Re-enable the Knative serving "GKE add-on".
  • Remove the ValidatingWebhookConfiguration admission webhook.

To begin the rollback process:

  1. Run the following command to start the migration script:

    ./migration-addon.sh --command rollback-uninstall-cloudrun-addon
    
  2. In the terminal, the migration script prompts you for your confirmation to perform each action. Enter y to at each prompt to proceed.

    The prompts during the process of re-enabling the "GKE add-on" look similar to the following:

    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. Verify the Knative serving "GKE add-on" is re-enabled:

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

    If the add-on is running in your cluster, the configuration details for the add-on are returned. Example:

    loadBalancerType=LOAD_BALANCER_TYPE_EXTERNAL