OpenFaaS¶
Installation¶
We use the YAML files of the GitHub repository openfaas/faas-netes for the installation of OpenFaaS modified for our use with the monitoring of other components.
Install it:
kubectl apply -f install/kubernetes/openfaas
Function deployment¶
The fastest method to deploy a function is to use the OpenFaaS Function Store via the OpenFaaS UI. To deploy a custom function the OpenFaaS CLI is necessary. Both methods are described in the following sections.
Function Store¶
- To open the OpenFaaS UI use the button provided in the MICO UI.

The necessary credentials are configured in the setup script. The default username is admin.
- After the login is completed the UI offers the ‘Deploy A New Function’ button. The button opens a list and it is possible to select a function from the store.

- After selecting a function, use the ‘Deploy’ button on the bottom of the list.
Custom Function¶
To build and deploy a custom function the following requirements are necessary:
- Kubectl must be configured (See the previous sections)
- Docker Hub account
- Docker
This tutorial is tested on windows. It should work on Linux too. All commands are tested in Powershell but should also work in the Git Bash.
- Install OpenFaaS CLI:
- Download the FaaS CLI from here
- (Optional) Point the path variable in windows to the directory of the faas-cli.exe
- In case of a problem read the readme from the download page.
- Configure the Docker Hub account in Docker (Docker Icon in Taskbar):
- Right-click docker icon in the taskbar
- Select Sign in
- Enter credentials
- Start the port forwarding with kubectl
kubectl port-forward svc/gateway -n openfaas 8080 - Log in with the faas CLI
faas-cli login --password PASSWORD faas-cli listshould now provide a list of all deploy functions- Change into the directory of a function (The root of a function contains the file stack.yml or
<function-Name>.yml) - Edit the yaml file (Not always necessary):
- The attributes
providerandgatewayshould have the valuesopenfaasandhttp://127.0.0.1:8080(Different values are possible for the gateway if for example no port forwarding is used) - The attribute
imageshould have the prefix of the Docker Hub account/organization name (e.g. “ustmico”)
- The attributes
- Use
faas-cli up(up = build, push, deploy) if the yaml file has the name stack.yaml orfaas-cli up -f function-name.ymlif the yaml file has a custom name. (e.g. “faas-cli up -f messaging-to-http-adapter.yml”) - Use the function (Look up the URL and other parameters in the OpenFaaS UI)
Troubleshooting
- If the deployment fails, check of the port forwarding is still running. It tends to break often.
- If the build fails, check if all files have Linux line endings (including the stack.yml)
- If the push fails, check if the DockerHub account is configured correctly
- If something else breaks read the OpenFaaS documentation or tutorials.
Example functions are located in our custom functions repository
Function Development¶
The development of functions is different for each programming language. But it is recommended to use a template for the language from here. The templates are also accessible from the OpenFaaS CLI with faas-cli new (e.g. faas-cli new <function-name> --lang java8)