Requirements:
- Kubernetes version > 1.19
- Kubectl
- Helm v3
Disclaimer: Only for local desktops. A separate process for cloud environments.
export FISSION_NAMESPACE="fission";
kubectl create namespace $FISSION_NAMESPACE;
kubectl create -k "github.com/fission/fission/crds/v1?ref=v1.17.0";
helm repo add fission-charts <https://fission.github.io/fission-charts/>;
helm repo update;
helm install --version v1.17.0 --namespace $FISSION_NAMESPACE fission \
--set serviceType=NodePort,routerServiceType=NodePort \
fission-charts/fission-all;
i. macOS
curl -Lo fission <https://github.com/fission/fission/releases/download/v1.17.0/fission-v1.17.0-darwin-amd64> \
&& chmod +x fission && sudo mv fission /usr/local/bin/
ii. Linux/WSL
curl -Lo fission <https://github.com/fission/fission/releases/download/v1.17.0/fission-v1.17.0-linux-amd64> \
&& chmod +x fission && sudo mv fission /usr/local/bin/
fission spec init
You can change name
to something else. image
must match the language you are using
fission env create --spec --name python --image fission/python-env --builder fission/python-builder
Clone the repo with example code
git clone https://github.com/NauqGnesh/fission-tutorial.git
Your functions should be structured as such:
.
├── room/
│ ├── room.py
│ └── requirements.txt
└── lamp/
├── lamp.py
└── requirements.txt
This will register a function to your fission namespace
--env
name of environment to execute function--name
name of function--src
source code--entrypoint
entrypoint of your code
fission function create --spec --name room --env python --src "room/*" --entrypoint room.main;
fission function create --spec --name lamp --env python --src "lamp/*" --entrypoint lamp.main;
This will create a trigger to invoke your fission functions
--method
HTTP method--url
route endpoint--function
name of function to be invoked
fission route create --spec --method GET --url /lamp --function lamp;
fission route create --spec --method GET --url /room --function room;
Addtionally, minikube doesn't support external load balancer, so we need to forward ports. Set <local port>
to a free port on your machine. Note: minikube uses 8080 by default
export FISSION_ROUTER=$(minikube ip):$(kubectl -n fission get svc router -o jsonpath='{...nodePort}');
kubectl --namespace fission port-forward $(kubectl --namespace fission get pod -l svc=router -o name) <local port>:8888 &
export FISSION_ROUTER=127.0.0.1:<local port>
fission spec validate
Use --watch
to deploy continuously
fission spec apply --wait
To invoke a function directly
fission function test --name lamp
To invoke a function via trigger
curl http://$FISSION_ROUTER/lamp