O'Reilly logo

Kubernetes for Serverless Applications by Russ McKendrick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

An example of reading data

The code for our new function is still quite simple:

import jsondef handler(context):    print context.json    return context.json

All this code does is take the JSON we post and display it back to us. Place it in a file called hello-name.py or use the one in the Chapter04/hello-world/ folder in the GitHub repository. Once you have the file you can create the function by running:

$ kubeless function deploy hello-name \   --from-file hello-name.py \   --handler hello-name.handler \   --runtime python2.7 \   --trigger-http

Once you have deployed the function, you check it has been created by running:

$ kubeless function ls

You should see two functions listed, hello and hello-name. Now that we have created our new function you can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required