Changing a bit the subject of this blog, I’ve been studying about serverless and some frameworks. And today we’re gonna talk a bit about Fission. I’ll not explain the basics about serverless, but maybe it’s a subject for a future post :)
Fission is a framework for serverless functions running on the top of Kubernetes. It runs on premise, on cloud or locally.
The main idea is to write short-lived functions to be ran based on a trigger. Fission supports a small amount of triggers: HTTP, timer, webhooks like slack and github and Kubernetes events.
The image below shows how it’s structured.
Fission has its router which does all the routing job, like receiving the HTTP requests, triggering from a webhook, etc.
It takes care of the rest: deployment, routing, scalability, availability. Use Kubernetes’ service discovery and networking to interoperate with other services, like Redis, Postgres, Etcd etc.
First step after instalation is to create the environment. Here I’m saying we’re gonna run with nodejs version 0.4.1, it also supports higher versions like 8.
Next step is to create your function based on the env if requires, in this case we’re using nodejs env and our function code is on hello.js
Next step is to expose your function with a HTTP verb and a URI, in this case it’ll be a GET to /hello
Last but not least, we need to call our function :) in this case we’re using curl to do it. As I called it from the terminal, I used a env var created by fission called FISSION_ROUTER, but we can use the IP and call from wherever we want.
- HTTP (previous example)
- Kubernetes events
- Github and slack webhooks
Languages and environments supported
After installing and playing with it locally, I had my impressions about Fission, and I’d like to share with you.
- Documentation is good;
- Minikube version suggested is v0.16.0, but it just works with v0.22.1;
- After installation all works perfectly fine;
Pre requisites is to understand how kubernetes work, what’s serverless and docker.