---
title: "OpenFaaS for Kubernetes | Hostman Docs"
description: "Learn how to deploy OpenFaaS on Kubernetes and build a serverless environment for running functions at scale. Step-by-step guide covers installation, CLI setup, ingress configuration, deploying built-in and custom functions, and integrating with Docker Hub for production-ready FaaS workflows."
---

> For the complete documentation index for AI agents, see [llms.txt](https://hostman.com/llms.txt).

OpenFaaS is an open-source platform for running functions (FaaS) on top of Kubernetes. It simplifies the deployment of small code units that execute on demand or in response to events.

At its core, OpenFaaS follows the Function as a Service (FaaS) model: you write a function, package it into a Docker image, and OpenFaaS handles scaling, networking, and lifecycle management.

It offers a user-friendly web interface and a command-line tool called `faas-cli`. You can write functions in popular languages such as Python, Node.js, Go, and others using pre-built templates.

The complete documentation for OpenFaaS on Kubernetes is available on the [official website](https://docs.openfaas.com/).

## Installing the Addon

To install OpenFaaS:

1.  Go to the **Kubernetes** section and click on your cluster.
2.  In the **Addons** tab, click **OpenFaaS**.
3.  In the **Configuration** window, find the `ingress` section and enable it by setting `enabled: true`. Also, specify your domain in the `host` parameter. This will simplify access to the dashboard and allow usage of `faas-cli`. If you enable `ingress`, you can disable `exposeServices`, which is used by default.
4.  Once parameters are set, click **Install** and wait for the installation to finish.

To verify everything is running, check the status of pods in the `openfaas-fn` namespace:

```shell
kubectl get pods -n openfaas-fn
```

Example output:

```shell
NAME                            READY   STATUS    RESTARTS      AGE
alertmanager-57767d864c-hdqdn   1/1     Running   0             19h
gateway-5f9c4b5754-ksr6x        2/2     Running   1 (19h ago)   19h
nats-6ddf479847-dxr2g           1/1     Running   0             19h
prometheus-6cbd946f66-wqdf8     1/1     Running   0             19h
queue-worker-57c7479989-bw282   1/1     Running   0             19h
```

If all pods are in `Running` status, the installation was successful.

## Installing the CLI

To work with OpenFaaS from the terminal, you need the `faas-cli` tool. It allows you to create functions, build and push images, deploy them to the cluster, invoke functions, and check their status.

It is available for Linux, macOS, and Windows. Use the following commands to install it:

**Linux/macOS**

```shell
curl -sSL https://cli.openfaas.com | sh
```

**macOS**

```shell
curl -sSL https://cli.openfaas.com | sh
```

Or, via Homebrew:

```shell
brew install faas-cli
```

**Windows (PowerShell)**

```shell
$version = (Invoke-WebRequest "https://api.github.com/repos/openfaas/faas-cli/releases/latest" | ConvertFrom-Json)[0].tag_name

(New-Object System.Net.WebClient).DownloadFile("https://github.com/openfaas/faas-cli/releases/download/$version/faas-cli.exe", "faas-cli.exe")
```

Verify the installation:

```shell
faas-cli version
```

## Example Usage

In this example, we will:

-   Deploy the OpenFaaS addon.
-   Bind a domain for easy dashboard access and CLI use.
-   Deploy a function from the built-in store.
-   Create and deploy a custom function using Docker Hub.

Requirements:

-   A domain or subdomain for OpenFaaS access.
-   Installed Nginx Ingress addon.
-   A Docker Hub account (for custom functions).
-   Installed `faas-cli` and Docker.

#### Deploying the Addon

Go to the dashboard and install the **OpenFaaS** addon. In the **Configuration** section, enable `ingress` by setting `enabled: true` and specifying your domain in the `host` field. Then start the installation.

#### Creating a Load Balancer

Create a `loadbalancer.yaml` manifest:

```yaml
apiVersion: v1
kind: Service
metadata:
  name: ingress-nginx-lb
  namespace: ingress-nginx
spec:
  selector:
    app.kubernetes.io/name: ingress-nginx
  type: LoadBalancer
  ports:
    - name: http
      port: 80
      targetPort: 80
      appProtocol: k8s.hostman.com/proto-http
    - name: https
      port: 443
      targetPort: 443
      appProtocol: k8s.hostman.com/proto-https
```

Apply it:

```shell
kubectl apply -f loadbalancer.yaml
```

Set the balancer’s IP as the A record of your domain. If you're using Hostman NS servers, just select the newly created load balancer. Otherwise, get its IP manually:

```shell
kubectl get svc --all-namespaces --field-selector spec.type=LoadBalancer
```

The IP will be under the `EXTERNAL-IP` column.

Visit the domain you configured—a basic auth prompt will appear.

Use the login `admin` and retrieve the password using:

```shell
kubectl -n openfaas-fn get secret basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode
```

After logging in, the dashboard will open.

![E036c968 493b 4791 Ab5a C7966782647e.png](https://content.hostman.com/assets/8dbdb2f7-c1d7-4088-96d2-97ec77ec8b08.png?width=2894&height=848)

_[OpenFaaS](https://www.openfaas.com/) Dashboard_

#### Working with Functions

Let’s move on to using functions. We’ll install a function from the built-in OpenFaaS store.

First, log in via the CLI. This will allow you to run commands related to function management:

```shell
faas-cli login \
  --gateway http://<domain> \
  --username admin \
  --password <password>
```

Where:

-   `domain` — the address specified during OpenFaaS installation;
-   `admin` — the default username;
-   `password` — the password can be retrieved with the following command:

```shell
kubectl -n openfaas-fn get secret basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode
```

Now install the `figlet` function, which converts text into ASCII art:

```shell
faas-cli store deploy figlet \
  --gateway http://<domain>
```

Make sure the function has been installed:

```shell
faas-cli list \
  --gateway http://<domain>
```

The list will now contain the `figlet` function with a status of `Ready`.

Invoke the function and pass a string as input:

```shell
echo "Hostman" | faas-cli invoke figlet \
  --gateway http://<domain>
```

You’ll receive ASCII art with the given text in response.

Now let’s go over deploying a custom function. Choose a template:

```shell
faas-cli template store list
```

Create a new function based on the desired template—for example, `python3-http`:

```shell
faas-cli new hello-k8s --lang python3-http
```

The following will be created:

-   `hello-k8s/handler.py` — the function code;
-   `stack.yaml` — the function manifest.

Before building, edit the `stack.yaml` file and specify the path to your Docker Hub image. For example:

```yaml
functions:
  hello-k8s:
    lang: python3-http
    handler: ./hello-k8s
    image: dockerhubuser/hello-k8s:latest
```

In the image `field`, specify your Docker Hub username and the image name. Note that OpenFaaS Community Edition only supports public images.

Build the image:

```shell
faas-cli build -f stack.yaml
```

After the image is built, push it to Docker Hub:

```shell
faas-cli push -f stack.yaml
```

Finally, deploy the function to your cluster:

```shell
faas-cli deploy -f stack.yaml \
  --gateway http://<domain>
```

After running the command, you’ll get a link to access the function.

![67ed7fe8 9a22 4515 Aeb8 0e9f49c8a07e.png](https://content.hostman.com/assets/0854d11f-63bb-4a4f-b3c4-c848c42e4406.png?width=1550&height=282)

Open the link. You should see the message "Hello from OpenFaaS!".
