Jack Moore

Email: jack(at)jmoore53.com
Project Updates

Fission on Kubernetes

18 Feb 2022 » kubernetes, configuration, functions

Installing Fission

# Create the fission namespace

# Installing Fission for K8s
kubectl config set-context --current --namespace=fission

kubectl create -k "github.com/fission/fission/crds/v1?ref=v1.15.1"
export FISSION_NAMESPACE="fission"
kubectl create namespace $FISSION_NAMESPACE
kubectl config set-context --current --namespace=$FISSION_NAMESPACE
kubectl apply -f https://github.com/fission/fission/releases/download/v1.15.1/fission-all-v1.15.1.yaml
# Installing Fission CLI
curl -Lo fission https://github.com/fission/fission/releases/download/v1.15.1/fission-v1.15.1-linux-amd64 \
    && chmod +x fission && sudo mv fission /usr/local/bin/

Creating an example Python Function


def main():
    return callAnotherFunction("test")

def callAnotherFunction(variableName):
    return "Hello {variableName}\n".format(variableName=variableName)
# Add the stock Python env to your Fission deployment
fission env create --name python --image fission/python-env

# A Python function that prints "hello world"
curl -LO https://raw.githubusercontent.com/fission/examples/master/python/hello.py

# Upload your function code to fission
fission function create --name hello-py --env python --code hello.py

# Test your function.  This takes about 100msec the first time.
fission function test --name hello-py
# Returns: Hello, world!

# Create route for it
fission route create --name helopy --url /hepy --function hello-py



// Due to go plugin mechanism,
// the package of function handler must be main package
package main

import (

func Handler(w http.ResponseWriter, r *http.Request) {

    // recommend
    v1 := r.Header.Get("HEADER_KEY_1")

    // need to convert string cases manually
    key := textproto.CanonicalMIMEHeaderKey("HEADER_KEY_2")
    // v2 type is []string
    v2, _ := r.Header[key]

    w.Write([]byte(fmt.Sprintf("v1: %s, v2: %v", v1, v2)))
# Create Environment
fission environment create --name go --image fission/go-env-1.16 --builder fission/go-builder-1.16

# Create Function
fission fn create --name helloworld --env go --src hw.go --entrypoint Handler

# Create Package Status
fission pkg info --name helloworld-8b091f12-d275-42b7-aea5-1e75cd831a6c

# Create Trigger
fission httptrigger create --method GET --url "/hego" --function helloworld

Issues with Go:

For archive of package with size larger than 256 KB, the package is uploaded to storage service. Double check fission-storage-pvc is properly setup if pkg BUILD_STATUS is not succeeded.

© Jack Moore