1

I'm attempting to trigger a Kubeless function (written as a Java method) and it doesn't seem to be working. I've tried everything I can think to try, but I've run out of ideas. Below is the Java method (it's basically an echo service, for now).

package io.kubeless;

import io.kubeless.Context;
import io.kubeless.Event;

public class MyHandler {
    public String handle(Event event, Context context) {
        return event.Data;
    }
}

The method was deployed using the following:

$ kubeless function deploy my-handler --runtime java1.8 --handler MyHandler.handle --from-file src/main/java/io/kubeless/MyHandler.java

I have verified it works by running the following:

$ kubeless function call my-handler --data "It works"
$ kubectl logs my-handler-6f67d567c5-r8cdb
    0 [pool-1-thread-38] INFO io.kubeless.Handler  - Response: It works

I then created a Kafka trigger and published a message to it using the following.

$ kubeless trigger kafka create test --function-selector created-by=kubeless,function=my-handler --trigger-topic test-topic
$ kubeless topic publish --topic test-topic --data "Hello from Kafka"
$ kubectl logs my-handler-6f67d567c5-r8cdb
    0 [pool-1-thread-38] INFO io.kubeless.Handler  - Response: It works

As you can see, the only log entry is the one from the initial call that wasn't triggered by a Kafka pub/sub. I have verified the trigger exists:

$ kubeless trigger kafka ls
NAME    NAMESPACE   TOPIC       FUNCTION SELECTOR
test    default     test-topic  function=my-handler

As far as I can tell, Kafka seems to be running (I've also checked the Kafka logs, to no avail):

$ kubectl get pods --namespace=kubeless
NAME                                          READY   STATUS    RESTARTS   AGE
kafka-0                                       1/1     Running   0          170m
kafka-trigger-controller-f6f7c699f-m6mcd      1/1     Running   0          170m
kubeless-controller-manager-59d484f4d-9wlhq   3/3     Running   10         4d22h
zoo-0                                         1/1     Running   0          170m

Why is publishing not triggering the function? Any suggestions are appreciated and I thank you in advance.

senfo
  • 28,488
  • 15
  • 76
  • 106

1 Answers1

2

I nerded out on this and there's an issue with the Kubeless kafka-trigger. Essentially, I'm getting this log when the message is picked up by the controller and tries to trigger the function:

time="2020-07-14T22:00:15Z" level=error msg="Unable to elaborate request: Unable to find the service for function my-handler"

This means that the controller cannot find the my-handler service to trigger the function. If you see the code, you see that it's a call to the K8s API server. So, my guess is that there's an API version mismatch on the newer K8s versions. My server is v1.18.2. I've created this issue to track.

Rico
  • 58,485
  • 12
  • 111
  • 141
  • I wanted to thank you for this yesterday, but I had been up since 3:00 AM and couldn't articulate anything to save my life. At any rate, my server is v1.18.3, so probably not much of a difference between us there. There has since been a reply to the issue you created, indicating Kubeless is not compatible with Kubernetes 1.18. I very much appreciate you taking the time to help me out with this. I'm new to both Kubernetes and Kubeless, so I was struggling to find anything more valuable in the log output to help me debug the issue. – senfo Jul 15 '20 at 09:59