Reputation: 1
I have a nuclio serverless function (deployed in minikube) that gets triggered by messages in RabbitMQ's queue. From what I know, nuclio scales based on CPU metrics and I wanted to scale it based on the queue's length using KEDA. Unfortunately, the scaling did not work, and when I check the keda-operator-metrics-apiserver, I get a "scaledObject name is not specified" error:
kubectl logs -l app=keda-operator-metrics-apiserver -n keda
E0322 18:06:25.317354 1 provider.go:103] keda_metrics_adapter/provider "msg"="please specify scaledObject name, it needs to be set as value of label selector \"scaledobject.keda.sh/name\" on the query" "error"="scaledObject name is not specified"
E0322 18:06:25.321840 1 status.go:71] apiserver received an error that is not an metav1.Status: &errors.errorString{s:"scaledObject name is not specified"}: scaledObject name is not specified
E0322 18:07:59.165516 1 provider.go:103] keda_metrics_adapter/provider "msg"="please specify scaledObject name, it needs to be set as value of label selector \"scaledobject.keda.sh/name\" on the query" "error"="scaledObject name is not specified"
E0322 18:07:59.165559 1 status.go:71] apiserver received an error that is not an metav1.Status: &errors.errorString{s:"scaledObject name is not specified"}: scaledObject name is not specified
This is the configuration file for my nuclio serverless function:
apiVersion: nuclio.io/v1
kind: NuclioFunction
metadata:
name: nuc-handler
namespace: nuclio
spec:
handler: "nuc-handler:NuclioHandler"
runtime: "golang"
build:
path: .
minReplicas: 1
triggers:
myRabbitMQTopic:
kind: "rabbit-mq"
url: "amqp://user:[email protected]:5672/"
attributes:
exchangeName: ""
queueName: subPopQueue
maxWorkers: 1
Also, more information I pulled from nuclio's dashboard about the serverless function:
metadata:
name: nuc-handler
labels:
nuclio.io/project-name: default
resourceVersion: "1073643"
spec:
handler: "nuc-handler:NuclioHandler"
runtime: golang
resources:
requests:
cpu: 25m
memory: 1Mi
image: "docker.io/arthurmerlin/processor-nuc-handler:latest"
imageHash: "1710788017019969350"
minReplicas: 1
maxReplicas: 1
targetCPU: 75
triggers:
default-http:
class: ""
kind: http
name: default-http
maxWorkers: 1
attributes:
serviceType: ClusterIP
myRabbitMQTopic:
class: ""
kind: rabbit-mq
name: myRabbitMQTopic
url: "amqp://user:[email protected]:5672/"
attributes:
exchangeName: ""
maxWorkers: 1
queueName: subPopQueue
version: -1
alias: latest
build:
functionConfigPath: functionconfig.yaml
registry: docker.io/arthurmerlin
codeEntryType: image
timestamp: 1710788173
image: ""
noCache: false
offline: false
dependencies: []
runtimeAttributes:
repositories: []
runRegistry: docker.io/arthurmerlin
platform: {}
readinessTimeoutSeconds: 120
securityContext: {}
disableDefaultHTTPTrigger: false
eventTimeout: ""
waitReadinessTimeoutBeforeFailure: false
This is the keda ScaledObject configuration file:
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: nuclio-nuc-handler
namespace: nuclio
spec:
scaleTargetRef:
kind: Deployment
name: nuclio-nuc-handler
pollingInterval: 1
cooldownPeriod: 30
minReplicaCount: 1
maxReplicaCount: 30
triggers:
- type: rabbitmq
metadata:
queueName: subPopQueue
host: amqp://user:[email protected]:5672/
mode: QueueLength
value: "1"
And here's the description of the ScaledObject:
kubectl describe ScaledObject -n nuclio
Name: nuclio-nuc-handler
Namespace: nuclio
Labels: scaledobject.keda.sh/name=nuclio-nuc-handler
Annotations: <none>
API Version: keda.sh/v1alpha1
Kind: ScaledObject
Metadata:
Creation Timestamp: 2024-03-22T19:08:31Z
Finalizers:
finalizer.keda.sh
Generation: 1
Resource Version: 1218243
UID: 6212e530-ce47-49be-99b2-f308c0e8f909
Spec:
Cooldown Period: 30
Max Replica Count: 30
Min Replica Count: 1
Polling Interval: 1
Scale Target Ref:
Kind: Deployment
Name: nuclio-nuc-handler
Triggers:
Metadata:
Host: amqp://user:[email protected]:5672/
Mode: QueueLength
Protocol: amqp
Queue Name: subPopQueue
Value: 1
Type: rabbitmq
Status:
Conditions:
Message: ScaledObject is defined correctly and is ready for scaling
Reason: ScaledObjectReady
Status: True
Type: Ready
Message: Scaling is not performed because triggers are not active
Reason: ScalerNotActive
Status: False
Type: Active
Message: No fallbacks are active on this scaled object
Reason: NoFallbackFound
Status: False
Type: Fallback
Status: Unknown
Type: Paused
External Metric Names:
s0-rabbitmq-subPopQueue
Health:
s0-rabbitmq-subPopQueue:
Number Of Failures: 0
Status: Happy
Hpa Name: keda-hpa-nuclio-nuc-handler
Original Replica Count: 1
Scale Target GVKR:
Group: apps
Kind: Deployment
Resource: deployments
Version: v1
Scale Target Kind: apps/v1.Deployment
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal KEDAScalersStarted 84s keda-operator Scaler rabbitmq is built.
Normal KEDAScalersStarted 84s keda-operator Started scalers watch
kubectl client version: v1.29.1 kubectl kustomize version: v5.0.4-0.20230601165947-6ce0bf390ce3 kubectl server version: v1.28.3
nuctl client version: "Label: 1.12.14, Git commit: 4d67f0d79e6008523e9a540c01f90ccde7357e44, OS: linux, Arch: amd64, Go version: go1.21.0"
RabbitMQ's chart: rabbitmq-12.14.0 RabbitMQ's APP version: 3.12.13
This is my first time using these tools (Kubernetes, configuring files, Serverless, etc.). If there's a ridiculously obvious mistake somewhere, I apologize. I also haven't seen examples of nuclio serverless functions being used with KEDA, so I'm not sure if KEDA works with nuclio..? I appreciate any help I can get. Thank you.
Upvotes: 0
Views: 149