Before upgrading a TKG cluster, the autoscaler must be paused. After you upgrade the TKr version of the cluster, you must update the autoscaler package version to match the TKr minor version.

Requirements

This task assumes you have installed the cluster autoscaler on a TKG cluster. See Install Cluster Autoscaler Using Kubectl.

Pre Cluster Upgrade: Pause the Autoscaler

Before you upgrade a TKG cluster with the autoscaler installed, you must first pause the autoscaler package.
  1. Pause the cluster autoscaler package by setting the paused boolean value to true in the autoscaler-data-values.yaml secret.
    ---
    apiVersion: v1
    kind: Secret
    metadata:
      name: autoscaler-data-values
      namespace: tkg-system
    stringData:
      values.yml: |
        ---
        arguments:
          ignoreDaemonsetsUtilization: true
          maxNodeProvisionTime: 15m
          maxNodesTotal: 0
          metricsPort: 8085
          scaleDownDelayAfterAdd: 10m
          scaleDownDelayAfterDelete: 10s
          scaleDownDelayAfterFailure: 3m
          scaleDownUnneededTime: 10m
        clusterConfig:
          clusterName: "gc1"
          clusterNamespace: "cluster"
        paused: true
  2. Apply the updates to the autoscaler-data-values secret.
    kubectl apply -f autoscaler-data-values.yaml

Upgrade the Cluster

Once the autoscaler is paused, proceed with updating the cluster.
  1. Upgrade the Kubernetes version of the TKG cluster.

    See Update a TKG Cluster by Editing the TKR Version.

Post Cluster Upgrade: Update the Autoscaler Package Version

After upgrading the cluster, update the version of the autoscaler package to match the TKr minor version, and disable pausing.
  1. Choose the corresponding autoscaler version.

    The minor versions of the TKr and the autoscaler package must match. For example, if you upgraded the cluster to TKr v1.28.8, you will need to use autoscaler v1.28.x package.

  2. Update autoscaler resources by setting the target autoscaler version and resetting paused to false.
    #autoscaler-package-upgrade.yaml
    ---
    apiVersion: packaging.carvel.dev/v1alpha1
    kind: PackageInstall
    metadata:
      name: autoscaler
      namespace: tkg-system
    spec:
      serviceAccountName: autoscaler-sa
      packageRef:
        refName: cluster-autoscaler.tanzu.vmware.com
        versionSelection:
          constraints: 1.28.0+vmware.1-tkg.1
      values:
      - secretRef:
          name: autoscaler-data-values
    ---
    apiVersion: v1
    kind: Secret
    metadata:
      name: autoscaler-data-values
      namespace: tkg-system
    stringData:
      values.yml: |
        ---
        arguments:
          ignoreDaemonsetsUtilization: true
          maxNodeProvisionTime: 15m
          maxNodesTotal: 0
          metricsPort: 8085
          scaleDownDelayAfterAdd: 10m
          scaleDownDelayAfterDelete: 10s
          scaleDownDelayAfterFailure: 3m
          scaleDownUnneededTime: 10m
        clusterConfig:
          clusterName: "gc1"
          clusterNamespace: "cluster"
        paused: false
  3. Apply the updates to the autoscaler package.
    kubectl apply -f autoscaler-package-upgrade.yaml
  4. Verify that the autoscaler pod is running in the kube-system namespace.
  5. Test the cluster autoscaler.

    Test Cluster Autoscaler.