Serverless with OpenFaaS and Python

Vivek Kumar Singh (~viveksyngh)


Description:

This workshop introduces how to build, deploy and run serverless functions on Kubernetes using OpenFaaS and Python. OpenFaaS is one of the most popular Open Source frameworks on the Cloud Native Landscape.

We start by deploying OpenFaaS to your laptop with Docker for Mac or Windows or a remote Kubernetes cluster and then learn how to build, deploy and invoke serverless functions written in Python or from the Function Store.

Topics will include: managing dependencies with pip, securely storing and using API tokens through secure secrets, monitoring functions with Prometheus, auto-scaling, asynchronous invocation and chaining functions together to create workflows.

We will finally create a Github bot which automatically respond to Github issues or add a label through the use of sentiment analysis. Similar concept can be used to build other event driven applications such as resizing an image when it is uploaded to s3/minio bucket, connecting to a large variety of online event-streams through IFTTT.com etc. This exercise will also enable you to build bots, auto-responders and integrations with social media, for use in Jenkins pipelines and IoT devices. OpenFaaS can also be used for deploying stateless microservices, machine learning models and more.

Agenda:

  1. Install and test OpenFaas
  2. Create a new Python function
  3. Manage dependencies using pip
  4. Go deeper with functions e.g headers, query string, HTTP context, chaining etc
  5. Create a GitHub bot

(Optional: If we are able to complete above topics)

  1. Managing Secrets, Auto Scaling and Asynchronous functions

Approximate Time Duration: 2.5 hours

Prerequisites:

  • Functions will be written in Python, so prior programming or scripting experience is preferred
    • Install the recommended code-editor / IDE VSCode
    • For Windows install Git Bash
    • Preferred OS: MacOS, Windows 10 Pro/Enterprise, Ubuntu Linux

Docker Installed:

  • Docker CE for Mac/Windows Edge edition
  • Docker CE for Linux

User should have basic familiarity with Docker Swarm/Kubernetes.

Alternatively, users can use this tool with Digital Ocean to automate the OpenFaaS installation and complete the workshop in browser. It significantly reduces the installation and setup time.

Speaker Info:

Vivek Kumar Singh

Vivek is having 5+ year of experience and working as a Senior Software Engineer at Akamai Technologies. He is an active contributor and Github member of OpenFaaS community. He has given several talks on OpenFaaS at local meetup groups like Kubernetes & Openshift India Community, Microsoft Developer Meetup Group, OpenFaaS meetup group, and others.

Farhan Ali Khan

Software engineer with strong interest in distributed systems and database storage. Working as a Senior Software Engineer at Cisco.

Section: Web development
Type: Workshop
Target Audience: Intermediate
Last Updated: