keda: Unable to DELETE the keda CRD scaledobjects.keda.sh

Report

I was trying to uninstall old keda 2.3,0 from cluster but unfortunately, I couldn’t delete the following CRD

kubectl delete customresourcedefinition scaledobjects.keda.sh

The below ones are removed

kubectl delete customresourcedefinition clustertriggerauthentications.keda.sh kubectl delete customresourcedefinition scaledjobs.keda.sh kubectl delete customresourcedefinition triggerauthentications.keda.sh

Then I ran the below command which ran succsfully

helm uninstall keda -n keda

But when I checked the crds ,I could see scaledobjects.keda.sh in terminating state,and I am unable to install any new keda version in Azure AKS ,when I run the below command

helm install keda kedacore/keda --namespace keda --version 2.10.1 --set nodeSelector.“kubernetes.io/os”=linux

I am getting the below error

Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: CustomResourceDefinition “scaledobjects.keda.sh” in namespace “” exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key “app.kubernetes.io/managed-by”: must be set to “Helm”; annotation validation error: missing key “meta.helm.sh/release-name”: must be set to “keda”; annotation validation error: missing key “meta.helm.sh/release-namespace”: must be set to “keda”

The above error I feel is due to the old scaledojects in the AKS cluster.

Is there a way to remove the unremoved CRD scaledobjects.keda.sh from the AKS cluster

Expected Behavior

Should be able to delete the crd (scaledobjects.keda.sh) and run the below command successfully in Azure Kubernetes

The above error I feel is due to the old scaledojects in the AKS cluster.

Is there a way to remove the unremoved CRD scaledobjects.keda.sh from the AKS cluster.

Actual Behavior

kubectl delete customresourcedefinition scaledobjects.keda.sh

The below ones are removed

kubectl delete customresourcedefinition clustertriggerauthentications.keda.sh kubectl delete customresourcedefinition scaledjobs.keda.sh kubectl delete customresourcedefinition triggerauthentications.keda.sh

Then I ran the below command which ran succsfully

helm uninstall keda -n keda

But when I checked the crds ,I could see scaledobjects.keda.sh in terminating state,and I am unable to install any new keda version in Azure AKS ,when I run the below command

helm install keda kedacore/keda --namespace keda --version 2.10.1 --set nodeSelector.“kubernetes.io/os”=linux

Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: CustomResourceDefinition “scaledobjects.keda.sh” in namespace “” exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key “app.kubernetes.io/managed-by”: must be set to “Helm”; annotation validation error: missing key “meta.helm.sh/release-name”: must be set to “keda”; annotation validation error: missing key “meta.helm.sh/release-namespace”: must be set to “keda”

The above error I feel is due to the old scaledojects in the AKS cluster.

Is there a way to remove the unremoved CRD scaledobjects.keda.sh from the AKS cluster

Steps to Reproduce the Problem

Logs from KEDA operator

The helm uninstall -n keda command removed the keda so no logs ,but the crd scaledobejcts.sh is still there example



### KEDA Version

2.3.0

### Kubernetes Version

1.25

### Platform

Microsoft Azure

### Scaler Details

_No response_

### Anything else?

_No response_

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 32 (17 by maintainers)

Most upvoted comments

Hi @nidiculageorge My previous comment has a link to helm docs about upgrade command. There you can see how you can set values during helm installation: image

The values that you have to update are these: https://github.com/kedacore/charts/blob/main/keda/values.yaml#L348-L372

Sorry but I won’t provide the command to you as IMHO it’s totally outside KEDA’s scope and it’s more related with your specific job and use case than with KEDA. I’ll help you with any issue related with KEDA, but I won’t give you the job already done, sorry

Hello, You don’t need to set that selector because it’s already added as default because KEDA only works on linux nodes. In your case, the problem is that the selector has to be escaped, but as I said, you can just remove it because it’s already set: image

Try again without the --set and let me know how it goes 😃

I guess this is solved, I close it (I can reopen it if you need anything else)

Latest versions have the process documented: keda.sh/docs/2.11/deploy/#uninstall

I sent you in my first message 😃

you need to remove KEDA custom resources (SO, SJ,…) and then helm uninstall…

Yes, you can use helm upgrade --install keda kedacore/keda --namespace keda --version 2.10.1 --set nodeSelector."kubernetes.io/os"=linux to upgrade the helm release with the version that you want. If you upgrade KEDA using helm, all the ScaledObjects will persist

Yeah, or place it in a bash script, or in the worst case, delete the finalizer manually Xd

Yes, you can do it and you have to do it for unlocking the ScaledObjects and then, you will be able to delete the CRD

BTW, why have you removed KEDA instead of just upgrade it using helm directly? Deleting KEDA you have to remove all the related resources and redeploy them once KEDA is updated. If you just upgrade KEDA using helm, all the ScaledObjects can be there and you don’t need to do anymore