keda: KEDA scaler not working on AKS with trigger authentication using pod identity
Report
KEDA scaler not scales with scaled object defined with trigger using pod identity for authentication for service bus queue.
I’m following this KEDA service bus triggered scaling project.
The scaling works fine with the connection string, but when I try to scale using the pod identity for KEDA scaler the keda operator fails to get the azure identity bound to it with the following keda operator error message log:
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).isScaledObjectActive
/workspace/pkg/scaling/scale_handler.go:228
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).checkScalers
/workspace/pkg/scaling/scale_handler.go:211
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).startScaleLoop
/workspace/pkg/scaling/scale_handler.go:145
2021-10-10T17:35:53.916Z ERROR azure_servicebus_scaler error {"error": "failed to refresh token, error: adal: Refresh request failed. Status Code = '400'. Response body: {\"error\":\"invalid_request\",\"error_description\":\"Identity not found\"}\n"}
My scaler objects’ definition is as below:
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: trigger-auth-service-bus-orders
spec:
podIdentity:
provider: azure
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: order-scaler
spec:
scaleTargetRef:
name: order-processor
# minReplicaCount: 0 Change to define how many minimum replicas you want
maxReplicaCount: 10
triggers:
- type: azure-servicebus
metadata:
namespace: demodemobus
queueName: orders
messageCount: '5'
authenticationRef:
name: trigger-auth-service-bus-orders
Im deploying the azure identity to the namespace keda where my keda deployment resides.
And installs KEDA with the following command to set the pod identity binding using helm:
helm install keda kedacore/keda --set podIdentity.activeDirectory.identity=app-autoscaler --namespace keda
Expected Behavior
The KEDA scaler should have worked fine with the assigned pod identity and access token to perform scaling
Actual Behavior
The KEDA operator could not be able to find the azure identity assigned and scaling fails
Steps to Reproduce the Problem
- Create the azure identity and bindings for the KEDA
- Install KEDA with the aadpodidentitybinding
- Create the scaledobject and triggerauthentication using KEDA pod identity
- The scaler fails to authenticate and scale
Logs from KEDA operator
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).isScaledObjectActive
/workspace/pkg/scaling/scale_handler.go:228
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).checkScalers
/workspace/pkg/scaling/scale_handler.go:211
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).startScaleLoop
/workspace/pkg/scaling/scale_handler.go:145
2021-10-10T17:41:54.909Z ERROR azure_servicebus_scaler error {"error": "failed to refresh token, error: adal: Refresh request failed. Status Code = '400'. Response body: {\"error\":\"invalid_request\",\"error_description\":\"Identity not found\"}\n"}
KEDA Version
No response
Kubernetes Version
1.20
Platform
Microsoft Azure
Scaler Details
Azure Service Bus
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 48 (16 by maintainers)
Posting e2e Script for AKS with kubenet plugin, if it is of any assistance to some:
Note: Read this instruction before you run AAD Identity On a Kubenet powered AKS.
@tomkerkhove @JorTurFer educated guess but 100% hit. selector is a problem there. I fixed and it works now. attaching e2e script it does everything except creating aks cluster. prvide aks name, aks rosource group name, node group name, and happy keda-ing 😃.
Hi @iarunpaul, First, please ignore the github-bot reaction, it’s an error in new workflow that we have merged a few days ago. We are working to fix it, but I’d like to apologize. Second, I will try to test it ASAP. Are you getting this error after some time or directly?
Finally I found it! My set up is for a workaround with KEDA for kubenet interface. I followed the e2e script by @dariuszbz, where my cluster is aks with the default kubenet network plugin. The order application works fine without any
nmimodifications and processes messages using the managed identity assigned to the application. But when installedKEDAusing helm and set the pod identity,keda operatorpod fails to get authorized: Logs are:Then I had to edit
nmicommand arguement to add--allow-network-plugin-kubenet=trueand thenmistarts running…Now the
nmipod reads:Still the order application doesn’t work. You need to delete and redeploy the application and wait for a few minutes… And thats it! Your application scales on KEDA metrics. Happy scaling!! Note: Always follow the mitigation steps and configure policies before enabling aad-pod-identity in a cluster with Kubenet.
Tring everything I have assigned the
myAksCluster-agentpoolin the$NodeResourceGroupwith theVirtual Machine ContributorandManage Identity Operatorroles on$NodeResourceGroupscope and now my KEDA trigger started working!!!kubectl get deploy -n keda-dotnet-sample -o wideOfcourse my application is not consuming the messages but the happy moment is that the KEDA works with pod id in AKS!
But I have to recreate and confirm it.
KEDA 2.4.0