Before deploying OpenFaaS Community Edition (CE), you will need to create a Kubernetes cluster. The cluster will need to have full access to the Internet at all times. If you need airgap support, or to run on an offline or restricted enterprise network, then OpenFaaS Standard would be a better fit for your needs.
In our experience, OpenFaaS CE and Pro will run on any Kubernetes cluster, whether that's a local version, self-managed on-premises, or a managed cloud offering.
The OpenFaaS helm chart ships with its own stack that includes NATS, Prometheus and a number of its own components like the OpenFaaS gateway and queue-worker, for more about what's included, you can read up on the stack.
The chart can be installed with helm and kubectl or arkade, we recommend arkade which also prints out everything you need to know to access the UI and deploy your first function.
From there, you should consider: adding a TLS certificate and trying out one of our training courses commissioned by the CNCF/LinuxFoundation, or an eBook.
k3s - a light-weight Kubernetes distribution ideal for development, edge and IoT
minikube - the original way to run Kubernetes on your local machine, with a separate Virtual Machine such as in this guide
microk8s - a Kubernetes distribution, specifically by Canonical for Ubuntu users.
We recommend using KinD to deploy OpenFaaS, however there are many different ways to run Kubernetes on your machine using a container, or a Virtual Machine.
Install OpenFaaS Community Edition (CE) via arkade or helm¶
There are three recommended ways to install OpenFaaS and you can pick whatever makes sense for you and your team. All options use the OpenFaaS helm chart.
1) Arkade (our recommended option)
We recommend using arkade to install openfaas, which makes installing OpenFaaS a 1-liner. It still uses the Helm chart, so it can also be used in production.
2) Helm
A helm chart is also available for those who are very well versed with kubectl and want to understand exactly what is being installed.
3) GitOps tooling
Whilst not recommended for local development, you may want to install OpenFaaS using a GitOps tool in your production environments because these can be configured to keep the chart up to date automatically.
The arkade install command installs OpenFaaS using its official helm chart. arkade can also install other important software for OpenFaaS users such as cert-manager and nginx-ingress. It's the easiest and quickest way to get up and running.
You can use arkade to install OpenFaaS to a regular cloud cluster, your laptop, a VM, a Raspberry Pi, or a 64-bit Arm machine.
Get arkade
# For MacOS / Linux:
curl-SLsfhttps://get.arkade.dev/|sudosh
# For Windows (using Git Bash)
curl-SLsfhttps://get.arkade.dev/|sh
Install the OpenFaaS app
arkadeinstallopenfaas-ce
Other options for installation are available with arkade install openfaas-ce --help
After the installation you'll receive a command to retrieve your OpenFaaS URL and password.
Infoforapp:openfaas-ce
# Get the faas-cliarkadegetfaas-cli
# Forward the gateway to your machinekubectlrolloutstatus-nopenfaasdeploy/gateway
kubectlport-forward-nopenfaassvc/gateway8080:8080&# If basic auth is enabled, you can now log into your gateway:PASSWORD=$(kubectlgetsecret-nopenfaasbasic-auth-ojsonpath="{.data.basic-auth-password}"|base64--decode;echo)echo-n$PASSWORD|faas-clilogin--usernameadmin--password-stdin
faas-clistoredeploynodeinfo
faas-clilist
# Find out more at:# https://github.com/openfaas/faas```
Youcangetthisinformationbackatanytimeusing:
```bash
arkadeinfoopenfaas
OpenFaaS Standard also ships with a Function Custom Resource Definition (CRD) which is required for use with GitOps tooling or to package functions with Helm.
Every time a function is deployed or is scaled up, Kubernetes will pull a potentially updated copy of the image from the registry. If you are using static image tags like latest, this is necessary.
When set to IfNotPresent, function deployments may not be updated when using static image tags like latest. IfNotPresent is particularly useful when developing locally with minikube. In this case, you can set your local environment to use minikube's docker so faas-cli build builds directly into the Docker library used by minikube. faas-cli push is unnecessary in this workflow - use faas-cli build then faas-cli deploy.
When set to Never, only local (or pulled) images will work. This is useful if you want to tightly control which images are available and run in your Kubernetes cluster.