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
- How do I expose my function as a service
- 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
Then surely you would need to include the
--namespace=smktest
in your invocation command, too:As best I can tell, there seems to be two approaches in use:
Deployment
template, which thefunction controller
appears to merge but as far as I knowcontainer: image:
is required in aDeployment
, so you'd have to specify one in order to get access to itsenv:
declarationPod
sServiceAccount
token to request cluster resources manually which might include aConfigMap
,Secret
, or even resolving your ownkubeless.io/function
manifest and pulling something out of its annotations or similar