vmware-archive / kubeless

Kubernetes Native Serverless Framework
https://kubeless.io
Apache License 2.0
6.86k stars 755 forks source link

Error when call to jvm kubeless function #891

Open sajit opened 6 years ago

sajit commented 6 years ago

I needed some help troubleshooting following issue.

Ive built a fat jar ie (jar with all dependencies included).

Below is the yaml file I use. example.yaml

apiVersion: kubeless.io/v1beta1
kind: Function
metadata:
  name: hwjava3
  namespace: smktest1
spec:
  runtime: jvm1.8
  timeout: "180"
  handler: com_company_Main.store
  function-content-type: url
  function: https://s3.amazonaws.com/<path>/trxlog-fatjar-1.0-SNAPSHOT.jar
  deployment:
    spec:
      template:
        spec:
          containers:
          - env:
            - name: FOO
              value: bar
            name: ""
            resources:
              limits:
                cpu: 100m
                memory: 100Mi
              requests:
                cpu: 100m
                memory: 100Mi

What happened: When I ran kubectl apply -f example.yaml function "hwjava3" created Then when I run kubeless function ls --namespace smktest1

NAME    NAMESPACE   HANDLER                 RUNTIME DEPENDENCIES    STATUS
hwjava3 smktest1    com_company_Main.store  jvm1.8                  1/1 READY

kubectl get pods --namespace smktest1 | grep hwjava3
hwjava3-564855b8b4-c5r9b   1/1       Running   0          17m

kubectl get services --namespace smktest1 | grep hwjava3
hwjava3   ClusterIP   10.108.2.179    <none>        8080/TCP   17m

kubectl get deployments --namespace smktest1 | grep hwjava3
hwjava3   1         1         1            1           17m

Finally when I try

kubeless function call hwjava3 --data hello
FATA[0000] Unable to find the service for hwjava3

What you expected to happen: I was hoping that the function would be called and the argument passed would get printed. My Handler is a simple function that takes in a string argument and prints it out.

How to reproduce it (as minimally and precisely as possible): Attaching the zipped version of fat jar trxlog-fatjar-1.0-SNAPSHOT.jar.zip

Anything else we need to know?:

Environment:

Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:28:34Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"} Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}

Kubeless version: v1.0.0-alpha.8

andresmgot commented 6 years ago

Hi @sajit, if the function is not in the default namespace you need to specify the flag:

kubeless function call --namespace smktest1 hwjava3 --data hello

can you try that?