No matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2" when installing knative serving

8.2k Views Asked by At

I followed the official instruction to installing knative serving on a self-built k8s cluster. But when running the second line

kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.9.2/serving-core.yaml

I got

unable to recognize "https://github.com/knative/serving/releases/download/knative-v1.9.2/serving-core.yaml": no matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2"
unable to recognize "https://github.com/knative/serving/releases/download/knative-v1.9.2/serving-core.yaml": no matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2"

I searched for similar errors, but found few things helpful.

My k8s cluster is built on two virtualbox VMs, one as the master node and one as the worker node. Both with:

  • ubuntu 22.04
  • docker version 20.10
  • k8s version 1.21.14

Here are the custom resources I got after running the first line.

$ kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.9.2/serving-crds.yaml
customresourcedefinition.apiextensions.k8s.io/certificates.networking.internal.knative.dev created
customresourcedefinition.apiextensions.k8s.io/configurations.serving.knative.dev created
customresourcedefinition.apiextensions.k8s.io/clusterdomainclaims.networking.internal.knative.dev created
customresourcedefinition.apiextensions.k8s.io/domainmappings.serving.knative.dev created
customresourcedefinition.apiextensions.k8s.io/ingresses.networking.internal.knative.dev created
customresourcedefinition.apiextensions.k8s.io/metrics.autoscaling.internal.knative.dev created
customresourcedefinition.apiextensions.k8s.io/podautoscalers.autoscaling.internal.knative.dev created
customresourcedefinition.apiextensions.k8s.io/revisions.serving.knative.dev created
customresourcedefinition.apiextensions.k8s.io/routes.serving.knative.dev created
customresourcedefinition.apiextensions.k8s.io/serverlessservices.networking.internal.knative.dev created
customresourcedefinition.apiextensions.k8s.io/services.serving.knative.dev created
customresourcedefinition.apiextensions.k8s.io/images.caching.internal.knative.dev created
$ kubectl get crd
NAME                                                  CREATED AT
certificates.networking.internal.knative.dev          2023-03-03T01:09:49Z
clusterdomainclaims.networking.internal.knative.dev   2023-03-03T01:09:49Z
configurations.serving.knative.dev                    2023-03-03T01:09:49Z
domainmappings.serving.knative.dev                    2023-03-03T01:09:49Z
images.caching.internal.knative.dev                   2023-03-03T01:09:50Z
ingresses.networking.internal.knative.dev             2023-03-03T01:09:49Z
metrics.autoscaling.internal.knative.dev              2023-03-03T01:09:50Z
podautoscalers.autoscaling.internal.knative.dev       2023-03-03T01:09:50Z
revisions.serving.knative.dev                         2023-03-03T01:09:50Z
routes.serving.knative.dev                            2023-03-03T01:09:50Z
serverlessservices.networking.internal.knative.dev    2023-03-03T01:09:50Z
services.serving.knative.dev                          2023-03-03T01:09:50Z

All I have done are these two lines of commands

$ kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.9.2/serving-crds.yaml
$ kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.9.2/serving-core.yaml

I am new to k8s custom resources and knative. Thanks in advance for any help.

1

There are 1 best solutions below

3
On

I believe Knative 1.9 requires Kubernetes 1.23 or newer. One of the changes that happened in the last year or so was the removal of the v2beta2 autoscaling API and replacement with v2 API. I believe the new API is present in Kubernetes 1.22, but Knative 1.9 was tested with the community supported versions as of January, which includes 1.26, 1.25, 1.24 and possibly 1.23.