This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Getting Started

1 - Installation

This document describes how to install OpenFunction.


  • You need to have a Kubernetes cluster.

  • You need to ensure your Kubernetes version meets the requirements described in the following compatibility matrix.

OpenFunction VersionKubernetes 1.17Kubernetes 1.18Kubernetes 1.19Kubernetes 1.20+

Install OpenFunction

Now you can install OpenFunction and all its dependencies with helm charts.

The ofn CLI install method is deprecated.


  • Kubernetes version: >=v1.20.0-0
  • Helm version: >=v3.6.3

Steps to install OpenFunction helm charts

  1. Run the following command to add the OpenFunction chart repository first:

    helm repo add openfunction
    helm repo update
  2. Then you have several options to setup OpenFunction, you can choose to:

    • Install all components:

      kubectl create namespace openfunction
      helm install openfunction openfunction/openfunction -n openfunction --version 0.3.1
    • Install Serving only (without build):

      kubectl create namespace openfunction
      helm install openfunction --set global.ShipwrightBuild.enabled=false --set global.TektonPipelines.enabled=false openfunction/openfunction -n openfunction --version 0.3.1
    • Install Knative sync runtime only:

      kubectl create namespace openfunction
      helm install openfunction --set global.Keda.enabled=false openfunction/openfunction -n openfunction --version 0.3.1
    • Install OpenFunction async runtime only:

      kubectl create namespace openfunction
      helm install openfunction --set global.Contour.enabled=false  --set global.KnativeServing.enabled=false openfunction/openfunction -n openfunction --version 0.3.1
  3. Run the following command to verify OpenFunction is up and running:

    kubectl get po -n openfunction

Uninstall OpenFunction


If you installed OpenFunction with Helm, run the following command to uninstall OpenFunction and its dependencies.

helm uninstall openfunction -n openfunction

Upgrade OpenFunction

helm upgrade [RELEASE_NAME] openfunction/openfunction -n openfunction

With Helm v3, CRDs created by this chart are not updated by default and should be manually updated. See also the Helm Documentation on CRDs.

Refer to helm upgrade for command documentation.

Upgrading an existing Release to a new version

From OpenFunction v0.6.0 to OpenFunction v0.7.x

There is a breaking change when upgrading from v0.6.0 to 0.7.x which requires additional manual operations.

Uninstall the Chart

First, you’ll need to uninstall the old openfunction release:

helm uninstall openfunction -n openfunction

Confirm that the component namespaces have been deleted, it will take a while:

kubectl get ns -o=jsonpath='{range .items[?(@.metadata.annotations.meta\.helm\.sh/release-name=="openfunction")]}{}: {.status.phase}{"\n"}{end}'

If the knative-serving namespace is in the terminating state for a long time, try running the following command and remove finalizers:

kubectl edit -n knative-serving

Upgrade OpenFunction CRDs

Then you’ll need to upgrade the new OpenFunction CRDs

kubectl apply -f

Upgrade dependent components CRDs

You also need to upgrade the dependent components’ CRDs

You only need to deal with the components included in the existing Release.

  • knative-serving CRDs
    kubectl apply -f
  • shipwright-build CRDs
    kubectl apply -f
  • tekton-pipelines CRDs
    kubectl apply -f

Install new chart

helm repo update
helm install openfunction openfunction/openfunction -n openfunction

2 - Quickstarts

2.1 - Prerequisites

Registry Credential

When building a function, you’ll need to push your function container image to a container registry like Docker Hub or To do that you’ll need to generate a secret for your container registry first.

You can create this secret by filling in the REGISTRY_SERVER, REGISTRY_USER and REGISTRY_PASSWORD fields, and then run the following command.

kubectl create secret docker-registry push-secret \
 --docker-server=$REGISTRY_SERVER \
 --docker-username=$REGISTRY_USER \

Source repository Credential

If your source code is in a private git repository, you’ll need to create a secret containing the private git repo’s username and password:

kubectl create secret generic git-repo-secret \
 --username=$USERNAME \

You can then reference this secret in the Function CR’s

kind: Function
  name: function-sample
  version: "v2.0.0"
  image: "openfunctiondev/sample-go-func:v1"
    name: push-secret
  port: 8080 # default to 8080
    builder: openfunction/builder-go:latest
      FUNC_NAME: "HelloWorld"
      FUNC_CLEAR_SOURCE: "true"
      url: ""
      sourceSubPath: "functions/knative/hello-world-go"
      revision: "main"
         name: git-repo-secret
        - name: function # DO NOT change this
          imagePullPolicy: IfNotPresent 
    runtime: "knative"


Async functions can be triggered by events in message queues like Kafka, here you can find steps to setup a Kafka cluster for demo purpose.

  1. Install strimzi-kafka-operator in the default namespace.

    helm repo add strimzi
    helm install kafka-operator -n default strimzi/strimzi-kafka-operator
  2. Run the following command to create a Kafka cluster and Kafka Topic in the default namespace. The Kafka and Zookeeper clusters created by this command have a storage type of ephemeral and are demonstrated using emptyDir.

    Here we create a 1-replica Kafka server named <kafka-server> and a 1-replica topic named <kafka-topic> with 10 partitions

    cat <<EOF | kubectl apply -f -
    kind: Kafka
      name: <kafka-server>
      namespace: default
        version: 3.3.1
        replicas: 1
          - name: plain
            port: 9092
            type: internal
            tls: false
          - name: tls
            port: 9093
            type: internal
            tls: true
          offsets.topic.replication.factor: 1
          transaction.state.log.replication.factor: 1
          transaction.state.log.min.isr: 1
          default.replication.factor: 1
          min.insync.replicas: 1
          type: ephemeral
        replicas: 1
          type: ephemeral
        topicOperator: {}
        userOperator: {}
    kind: KafkaTopic
      name: <kafka-topic>
      namespace: default
      labels: <kafka-server>
      partitions: 10
      replicas: 1
        cleanup.policy: delete 7200000
        segment.bytes: 1073741824
  3. Run the following command to check Pod status and wait for Kafka and Zookeeper to run and start.

    $ kubectl get po
    NAME                                              READY   STATUS        RESTARTS   AGE
    <kafka-server>-entity-operator-568957ff84-nmtlw   3/3     Running       0          8m42s
    <kafka-server>-kafka-0                            1/1     Running       0          9m13s
    <kafka-server>-zookeeper-0                        1/1     Running       0          9m46s
    strimzi-cluster-operator-687fdd6f77-cwmgm         1/1     Running       0          11m

    Run the following command to view the metadata for the Kafka cluster.

    $ kafkacat -L -b <kafka-server>-kafka-brokers:9092

2.2 - Create sync functions

Before you creating any functions, make sure you’ve installed all the prerequisites

Sync functions are funtions whose inputs are payloads of HTTP requests, and the output or response are sent to the waiting client immediately after the function logic finishes processing the inputs payload. Below you can find some sync function examples in different languages:

Sync Functions
GoHello World, Multi-functions, Sync function with path parameters, log processing, Sync function with output binding
NodejsHello World, Sync function with output binding
PythonHello World
JavaHello World, Sync function with output
DotNetHello World

You can find more function samples here

2.3 - Create async functions

Before you creating any functions, make sure you’ve installed all the prerequisites

Async functions are event-driven and their inputs are usually events from Non-HTTP event sources like message queues, cron triggers, MQTT brokers etc. and usually the client will not wait for an immediate response after triggering an async function by delivering an event. Below you can find some async function examples in different languages:

Async Functions
GoKafka input & HTTP output binding, Cron input & Kafka output binding, Cron input binding, Kafka input binding, Kafka pubsub
NodejsMQTT binding & pubsub
JavaCron input & Kafka output binding, Kafka pubsub

You can find more function samples here