days
0
6
hours
1
5
minutes
2
5
seconds
1
3
search
No containers to build

New serverless framework for Kubernetes focuses on developer productivity

Gabriela Motroc

Fission is a new framework for serverless functions on Kubernetes. It focuses on high performance and developer productivity by allowing developers focus on the task and hand, not on infrastructure. Fission is still in early alpha, so you should not use it in production just yet.

Fission is a framework for serverless functions on Kubernetes which keeps both Kubernetes and Docker abstracted away under normal operation in order to help developers focus on the task at hand, not on infrastructure. However, you can use both to extend Fission if you want to.

Fission is extensible to any programming language (out of the box, it comes with Python and NodeJS support but more languages are coming soon). Its core is written in Go and language-specific parts are isolated in environments. Plus, the framework it fast: it maintains a pool of “warm” containers, each containing a small dynamic loader. When a function is “cold-started” (first called) a running container is chosen and the function is loaded. Cold-start latencies are usually about 100msec.

Why Kubernetes?

According to the project description, Fission is built on top of Kubernetes because its creators “think any non-trivial app will use a combination of serverless functions and more conventional microservices, and Kubernetes is a great framework to bring these together seamlessly.” Furthermore, anything you do for operations on your Kubernetes cluster — such as monitoring or log aggregation — also helps with ops on your Fission deployment.

Let’s dive into some of the framework’s concepts:

  • A function represents a piece of code which follows the fission function interface.
  • The environment encompasses of the language- and runtime-specific parts of running a function (An environment is essentially just a container with a webserver and dynamic loader.)
  • A trigger maps an event to a function; Fission supports HTTP routes as triggers but support for other types of event triggers will be coming soon.

This is how it works:

# Add the stock NodeJS env to your Fission deployment
  $ fission env create --name nodejs --image fission/node-env

  # A javascript one-liner that prints "hello world"
  $ echo 'module.exports = function(context, callback) { callback(200, "Hello, world!\n"); }' > hello.js  

  # Upload your function code to fission
  $ fission function create --name hello --env nodejs --code hello.js

  # Map GET /hello to your new function
  $ fission route create --method GET --url /hello --function hello

  # Run the function.  This takes about 100msec the first time.
  $ curl http://$FISSION_ROUTER/hello
  Hello, world!

How to compile Fission

What you need:

  • Go
  • the glide dependecy management tool
  • docker for building images

How to do it:

The server side is compiled as one binary (“fission-bundle”) which contains controller, poolmgr and router; it invokes the right one based on command-line arguments.

To build fission-bundle: clone this repo, then from the top level directory

 # Get dependencies
  $ glide install

  # Build fission server and an image
  $ pushd fission-bundle
  $ ./build.sh

  # Edit push.sh to point to your registry
  $ $EDITOR push.sh
  $ ./push.sh
  $ popd

  # To install, update fission.yaml to point to your compiled image
  $ $EDITOR fission.yaml
  $ kubectl create -f fission.yaml

If you are changing the CLI

 # Build Fission CLI
  $ cd fission && go install

Don’t forget that Fission is still in early alpha, so using it in production is not recommended right now.

Author
Gabriela Motroc
Gabriela Motroc is an online editor for JAXenter.com. Before working at S&S Media she studied International Communication Management at The Hague University of Applied Sciences.

Comments
comments powered by Disqus