This plugin enables support for Kubeless within the Serverless Framework.
Clone or download
Latest commit f24dff2 Sep 20, 2018

Kubeless Serverless Plugin

This plugin brings Kubeless support within the Serverless Framework.

Kubeless is a Kubernetes-native Serverless solution.

Pre requisites

Make sure you have a kubernetes endpoint running and kubeless installed. You can find the installation intructions here.

Once you have Kubeless running in your cluster you can install serverless

$ npm install serverless -g

Try out the example

Clone this repo and check the example function

$ git clone
$ cd examples/get-python
$ cat serverless.yml
service: hello

  name: kubeless
  runtime: python2.7

  - serverless-kubeless

    description: 'Hello function'
    handler: handler.hello

Download dependencies

$ npm install

Deploy function.

$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Deploying function hello...
Serverless: Function hello successfully deployed

The function will be deployed to k8s via kubeless.

$ kubectl get function

$ kubectl get po
NAME                     READY     STATUS    RESTARTS   AGE
hello-1815473417-1ttt7   1/1       Running   0          1m

Now you will be able to call the function:

$ serverless invoke -f hello -l
Serverless: Calling function: hello...
hello world

You can also check the logs for the function:

$ serverless logs -f hello - - [12/Jul/2017:09:47:18 +0000] "GET /healthz HTTP/1.1" 200 2 "" "Go-http-client/1.1" 0/118 - - [12/Jul/2017:09:47:21 +0000] "GET /healthz HTTP/1.1" 200 2 "" "Go-http-client/1.1" 0/93 - - [12/Jul/2017:09:47:24 +0000] "GET /healthz HTTP/1.1" 200 2 "" "Go-http-client/1.1" 0/108 - - [12/Jul/2017:09:47:25 +0000] "GET / HTTP/1.1" 200 11 "" "" 0/316

Or you can obtain the function information:

$ serverless info
Service Information "hello"
Cluster IP:
Type:  ClusterIP
  Name:  http-function-port
  Protocol:  TCP
  Port:  8080
  Target Port:  8080
Function Info
Description: Hello function
Handler:  handler.hello
Runtime:  python2.7
Trigger: HTTP

You can access the function through its HTTP interface as well using kubectl proxy and accessing:

$ curl
hello world

If you have a change in your function and you want to redeploy it you can run:

$ serverless deploy function -f hello
Serverless: Redeploying hello...
Serverless: Function hello successfully deployed

Finally you can remove the function.

$ serverless remove
Serverless: Removing function: hello...
Serverless: Function hello successfully deleted