Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KEDA operator deployment has error when deployed locally #3751

Closed
aavarghese opened this issue Oct 13, 2022 · 8 comments
Closed

KEDA operator deployment has error when deployed locally #3751

aavarghese opened this issue Oct 13, 2022 · 8 comments
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity

Comments

@aavarghese
Copy link

aavarghese commented Oct 13, 2022

Report

make deploy of main branch causing keda-operator deployment to throw error below

2022-10-13T20:09:36Z	ERROR	controller-runtime.source	if kind is a CRD, it should be installed before calling Start	{"kind": "HorizontalPodAutoscaler.autoscaling", "error": "no matches for kind \"HorizontalPodAutoscaler\" in version \"autoscaling/v2\""}
sigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start.func1.1
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/source/source.go:139
k8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtectionWithContext
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:233
k8s.io/apimachinery/pkg/util/wait.WaitForWithContext
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:660
k8s.io/apimachinery/pkg/util/wait.poll
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:594
k8s.io/apimachinery/pkg/util/wait.PollImmediateUntilWithContext
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:545
sigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start.func1
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/source/source.go:132

Expected Behavior

No errors in deployment.

Actual Behavior

Error in keda-operator pod (Error pasted above).

And pods restarting due to it:

ansuvarghese$ k get pods -n keda
NAME                                      READY   STATUS    RESTARTS      AGE
keda-metrics-apiserver-76fb58fc74-8k68t   1/1     Running   0             9m27s
keda-operator-7b9d7667fd-x66pm            1/1     Running   1 (96s ago)   3m45s

Steps to Reproduce the Problem

  1. make docker-build
  2. make publish (changed ghcr repo to my personal docker hub repo)
  3. VERSION=main make deploy

Logs from KEDA operator

2022-10-13T20:14:29Z	ERROR	controller-runtime.source	if kind is a CRD, it should be installed before calling Start	{"kind": "HorizontalPodAutoscaler.autoscaling", "error": "no matches for kind \"HorizontalPodAutoscaler\" in version \"autoscaling/v2\""}
sigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start.func1.1
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/source/source.go:139
k8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtectionWithContext
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:233
k8s.io/apimachinery/pkg/util/wait.WaitForWithContext
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:660
k8s.io/apimachinery/pkg/util/wait.poll
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:594
k8s.io/apimachinery/pkg/util/wait.PollImmediateUntilWithContext
	/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:545
sigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start.func1
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/source/source.go:132

KEDA Version

main

Kubernetes Version

No response

Platform

Red Hat OpenShift

Scaler Details

Kafka

Anything else?

No response

@aavarghese aavarghese added the bug Something isn't working label Oct 13, 2022
@JorTurFer
Copy link
Member

JorTurFer commented Oct 14, 2022

Hey,
What k8s version are you using? It seems that you are using <= v1.22 which currently is not supported because KEDA (in ´main´ tag) is already using autoscaling/v2 and that's API was introduced in k8s v1.23.
We follow N-2 support policy and due to autoscaling/v2beta1 and autoscaling/v2beta2 deprecation, we migrate KEDA to autoscaling/v2 which requires k8s v1.23 (N-2).
There isn't any workaround for this, you need to update your cluster to at least v1.23 and the deployment will work again

@stale
Copy link

stale bot commented Dec 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Dec 13, 2022
@stale
Copy link

stale bot commented Dec 20, 2022

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Dec 20, 2022
@tvert
Copy link

tvert commented May 18, 2023

Hi, I got similar error in the logs:
... calling Start {"kind": "HorizontalPodAutoscaler.autoscaling", "error": "no matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2beta2""}
sigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start.func1.1

I am using microk8s (Ubuntu 22.04) - Here is the kubectl version:

k version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.26.4
Kustomize Version: v4.5.7
Server Version: v1.26.4

I enabled community addons and deployed Keda that way. I grab the yaml feil from this article about Keda to deploy a 'ScaledObject':
Trigger a Kubernetes HPA with Prometheus metrics

The API versions in my cluster are:

k api-versions
admissionregistration.k8s.io/v1
apiextensions.k8s.io/v1
apiregistration.k8s.io/v1
apps/v1
authentication.k8s.io/v1
authorization.k8s.io/v1
autoscaling/v1
autoscaling/v2
...
keda.sh/v1alpha1
...
metrics.k8s.io/v1beta1
monitoring.coreos.com/v1
monitoring.coreos.com/v1alpha1
networking.k8s.io/v1
...

I got a full log file if needed. Here some extracts:

2023-05-18T07:26:34Z INFO controller-runtime.metrics Metrics server is starting to listen {"addr": ":8080"}
2023-05-18T07:26:34Z INFO setup Running on Kubernetes 1.26 {"version": "v1.26.4"}
2023-05-18T07:26:34Z INFO setup Starting manager
2023-05-18T07:26:34Z INFO setup KEDA Version: 2.8.0
2023-05-18T07:26:34Z INFO setup Git Commit: a4a1182
2023-05-18T07:26:34Z INFO setup Go Version: go1.17.13
2023-05-18T07:26:34Z INFO setup Go OS/Arch: linux/amd64
2023-05-18T07:26:34Z INFO Starting server {"path": "/metrics", "kind": "metrics", "addr": "[::]:8080"}
2023-05-18T07:26:34Z INFO Starting server {"kind": "health probe", "addr": "[::]:8081"}
I0518 07:26:34.620696 1 leaderelection.go:248] attempting to acquire leader lease keda/operator.keda.sh...
I0518 07:26:52.438244 1 leaderelection.go:258] successfully acquired lease keda/operator.keda.sh
...
2023-05-18T07:27:12Z ERROR controller-runtime.source if kind is a CRD, it should be installed before calling Start {"kind": "HorizontalPodAutoscaler.autoscaling", "error": "no matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2beta2""}
sigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start.func1.1
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/source/source.go:139
k8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtectionWithContext
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:233
k8s.io/apimachinery/pkg/util/wait.WaitForWithContext
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:660
k8s.io/apimachinery/pkg/util/wait.poll
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:594
k8s.io/apimachinery/pkg/util/wait.PollImmediateUntilWithContext
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:545
sigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start.func1
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/source/source.go:132
...

It looks to me that Keda (via the addons comminuty for microk8s) is trying to used an old api version 'autoscaling/v2beta2' instead of 'autoscaling/v2'.

@JorTurFer
Copy link
Member

JorTurFer commented May 18, 2023

Hi @tvert ,
Microk8s addon is using keda v2.8.
2023-05-18T07:26:34Z INFO setup KEDA Version: 2.8.0
For k8s >= 1.25 you should use KEDA v2.9 or above

@tvert
Copy link

tvert commented May 18, 2023

Hi @JorTurFer ,

Thanks for the hint.
Do you know if there is a plan for the microk8s addon to be updated to 2.9?

Thanks

Q: If I have to do a manual install, do you know or have links to help with the manual installation process?
A: I find this documentation here: https://keda.sh/docs/2.10/deploy/

@JorTurFer
Copy link
Member

Thanks for the hint. Do you know if there is a plan for the microk8s addon to be updated to 2.9?

IDK because we don't manage it. Maybe you could ask in their repo

@tvert
Copy link

tvert commented May 18, 2023

I used the documentaion provided by the release notes:
https://keda.sh/docs/2.10/deploy/#yaml

And it works - I was able to deploy my ScaleObject yaml file - no more apiversion issues. Thank you @JorTurFer for the hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity
Projects
Archived in project
Development

No branches or pull requests

3 participants