Kubeless function invoke error

8/21/2018

Im having trouble invoking functions using kubeless. Here is the function spec

---
apiVersion: kubeless.io/v1beta1
kind: Function
metadata:
  name: smk
  namespace: smktest
spec:
  handler: hello.handler
  runtime: python2.7
  function: |
      import json
      def handler():
              return "hello world"
  deployment:
    spec:
      template:
        spec:
          containers:
             - env:
               - name: FOO
                 value: bar
               name: "smk-deployment"
               resources:
                 limits:
                   cpu: 100m
                   memory: 100Mi
                 requests:
                   cpu: 100m
                   memory: 100Mi

When I try to call the function as below,

kubeless function call smk 

I get

FATA[0000] Unable to find the service for smk

Two part question

  1. How do I expose my function as a service
  2. How do I specify Environment variables needed by this function ? Thank you

Update Running kubeless function ls --namespace=smktest yields below

NAME    NAMESPACE   HANDLER         RUNTIME     DEPENDENCIES    STATUS
smk     smktest     hello.handler   python2.7                   MISSING: Check controller logs

Next I tried kubectl logs -n kubeless -l kubeless=controller there's tons of error logs but I don't see anything specific to this function

-- smk
kubeless
kubernetes
serverless-framework

1 Answer

8/22/2018

When I try to call the function as below,

kubeless function call smk

I get

FATA[0000] Unable to find the service for smk

Running kubeless function ls --namespace=smktest

Then surely you would need to include the --namespace=smktest in your invocation command, too:

kubeless function call --namespace=smktest smk 

How do I specify Environment variables needed by this function ? Thank you

As best I can tell, there seems to be two approaches in use:

-- mdaniel
Source: StackOverflow