Skip to content

Kubeless

Theory

  • Kubeless is the Kubernetes Native serverless framework
  • Allows to deploy functions without the need to build containers
  • These functions can be called via regular HTTP(S) calls or triggered by events submitted to message brokers like Kafka

Practice

Command Description
kubectl create ns kubeless Create a kubeless namespace where you will install the controller
curl -sL https://github.com/kubeless/kubeless/releases/download/v0.3.0/kubeless-rbac-v0.3.0.yaml kubectl create -f - Install the latest stable version with a kubectl create command
kubectl get pods -n kubeless List pods
$ cat toy.py
def handler(event):
print event.json
return event.json

$ kubeless function
deploy toy
--runtime python2.7
--handler toy.handler
--from-file toy.py
--trigger-http
Deploy python function
kubeless function
update toy --from-file toy-update.py
Update the function
kubeless function ls List the function
kubeless function
call toy --data '{"hello":"world"}'
Call the function
kubeless function logs toy Get the logs of the function
kubeless function describe toy Describe the function
kubeless function delete toy Delete the function