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.
- Pause the cluster autoscaler package by setting the
paused
boolean value totrue
in theautoscaler-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
- 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.
- Upgrade the Kubernetes version of the TKG cluster.
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.
- 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.
- 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
- Apply the updates to the autoscaler package.
kubectl apply -f autoscaler-package-upgrade.yaml
- Verify that the autoscaler pod is running in the kube-system namespace.
- Test the cluster autoscaler.