Minimal steps to run serveless/functions-as-a-service platform on Minikube.
Start minikube.
minikube startInstall helm, if you haven’t already.
brew install kubernetes-helmInstall openfass CLI.
brew install faas-cliCreate a new service account for Helm. We are calling it tiller.
kubectl -n kube-system create sa tiller \ && kubectl create clusterrolebinding tiller \ — clusterrole cluster-admin \ — serviceaccount=kube-system:tillerStart helm.
helm init --skip-refresh --upgrade --service-account tillerGet openfass kubernetes integration.
git clone https://github.com/openfaas/faas-netes && cd faas-netesInstall openfass on Kubernetes.
helm upgrade — install --debug --reset-value --set async=false --set rbac=false openfaas openfaas/At this point you should see that kubernetes has deployed our serverless infrastructure.
kubectl get podsNAME READY STATUS RESTARTS AGE alertmanager-2526763497-qxzwb 1/1 Running 0 43m faas-netesd-1969965387-mtfn3 1/1 Running 0 43m gateway-640487255-5k2xr 1/1 Running 0 43m hello-4272447001-lkxcs 1/1 Running 0 22m prometheus-3793543547-w13ln 1/1 Running 0 43mYou can also look at the the ui
minikube service gateway-external
Now, that we have infrastructure, lets build and deploy a python hello world function.
faas-cli new --lang python helloThis will create
hello.yml,hello/handler.pyandhello/requirements.txt.hello.ymldescribes the deployment (service name, image to be used etc.). You want to change the image fromhelloto<your_docker_id>/helloprovider: name: faas gateway: http://localhost:8080 functions: hello: lang: python handler: ./hello image: dharmeshkakadia/hellohello/handler.pyhas the code to handle request. In our case it just prints back the string.def handle(st): print(st)The requirements file is empty since we don’t have any dependencies right now.
Lets build our code, docker image and push it to registry. We will use docker with Kubernetes for this purpose.
eval $(minikube docker-env) docker login faas-cli build -f hello.yml faas-cli push -f hello.ymlDeploy the hello function service.
faas-cli deploy -f hello.yml --gateway $(minikube service gateway-external --url)At this point you should be seeing the service is deployed
Deploying: hello. No existing function to remove Deployed. URL: http://192.168.64.4:31112/function/hello 202 Accepted
You can confirm it in UI as well.
You are now ready to test the service. You can invoke it from UI, via REST api or through CLI.
echo world | faas-cli invoke hello --gateway $(minikube service gateway-external --url)The UI will show the invocation count has changed. You can also confirm it through CLI.

The Prometheus dashboard also has the metrics for the service. Here is the dashboard showing invocation count.
minikube service prometheus-external
Finally you can remove the hello function with
faas-cli remove hello --gateway $(minikube service gateway-external --url)Thats it ! OpenFaaS looks a great platform. Give it a try !
