Updating HorizontalPodAutoscaler API version for Cloud Platform - removed Kubernetes v1.25
The autoscaling/v2beta1 API version of HorizontalPodAutoscaler is no longer served as of v1.25.
The autoscaling/v2beta2 API version of HorizontalPodAutoscaler is no longer served as of v1.26.
Cloud Platform users must ensure any HorizontalPodAutoscaler manifests are migrated to use the autoscaling/v2 API version, which is supported on our current cluster version (v1.32 as of writing).
Further details can be found within the Kubernetes deprecation guide - 1.25 and Kubernetes deprecation guide - 1.26
How to check and replace the deprecated apiVersion
Prerequisite: Install pluto to find out whether any of the manifest has any of the deprecated APIs.
brew install FairwindsOps/tap/pluto
To check if you are using deprecated apiVersion, run the following command:
pluto detect-all-in-cluster --namespace <your namespace>
If there is any deprecated apiVersion of HorizontalPodAutoscaler, the output will look like this:
0928 17:32:43.721283 34578 request.go:697] Waited for 1.045015006s due to client-side throttling, not priority and fairness, request: GET:https://DF366E49809688A3B16EEC29707D8C09.gr7.eu-west-2.eks.amazonaws.com/apis/mutations.gatekeeper.sh/v1beta1?timeout=32s
E0928 17:32:44.561983 34578 discovery_api.go:117] Failed to retrieve: /v1, Resource=bindings the server does not allow this method on the requested resource
E0928 17:32:44.791255 34578 discovery_api.go:117] Failed to retrieve: authorization.k8s.io/v1, Resource=localsubjectaccessreviews the server does not allow this method on the requested resource
NAME KIND VERSION REPLACEMENT REMOVED DEPRECATED REPL AVAIL
helloworld-hpa HorizontalPodAutoscaler autoscaling/v2beta1 autoscaling/v2 true true true
For resources deployed using helm chart, irrespective of the resource exists in the cluster, the above list shows that the helm manifest deployed has the deprecated API version, so it needs to be updated.
Update apiVersion as the following example and apply the manifest:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: helloworld-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: helloworld-hpa
minReplicas: 3
maxReplicas: 10
Run the following command to check if the manifest is updated:
pluto detect-all-in-cluster --namespace <your namespace>
For additional information on creating HorizontalPodAutoscaler see here
Was this page useful?