Serverless with OpenFaaS and Python
Vivek Kumar Singh (~viveksyngh) |
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.
- Install and test OpenFaas
- Create a new Python function
- Manage dependencies using pip
- Go deeper with functions e.g headers, query string, HTTP context, chaining etc
- Create a GitHub bot
(Optional: If we are able to complete above topics)
- Managing Secrets, Auto Scaling and Asynchronous functions
Approximate Time Duration: 2.5 hours
- 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 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.
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.