Installing Knative Functions

You can install Knative Functions either by using the standalone func CLI, or by installing the kn func plugin that is available for the Knative kn CLI.

Installing the func CLI

HomebrewExecutable binaryGoContainer image

To install func using Homebrew, run the following commands:

  1. brew tap knative-extensions/kn-plugins
  1. brew install func

If you have already installed the kn CLI by using Homebrew, the func CLI is automatically recognized as a plugin to kn, and can be referenced as kn func or func interchangeably.

Note

Use brew upgrade instead if you are upgrading from a previous version.

You can install func by downloading the executable binary for your system and placing it in the system path.

  1. Download the binary for your system from the func release page.

  2. Rename the binary to func and make it executable by running the following commands:

    1. mv <path-to-binary-file> func
    1. chmod +x func

    Where <path-to-binary-file> is the path to the binary file you downloaded in the previous step, for example, func_darwin_amd64 or func_linux_amd64.

  3. Move the executable binary file to a directory on your PATH by running the command:

    1. mv func /usr/local/bin
  4. Verify that the CLI is working by running the command:

    1. func version
  5. Check out the func client repository and navigate to the func directory:

    1. git clone https://github.com/knative/func.git func
    1. cd func/
  6. Build an executable binary:

    1. make
  7. Move func into your system path, and verify that func commands are working properly. For example:

    1. func version

Run func from a container image. For example:

  1. docker run --rm -it ghcr.io/knative/func/func create -l node -t http myfunc

Links to images are available here:

Note

Running func from a container image does not place the binary on a permanent path. This procedure must be repeated each time you want to use func.

Installing the kn func CLI plugin

kn plugin

You can install Knative Functions as a kn CLI plugin, by downloading the executable binary for your system and placing it in the system path.

  1. Download the binary for your system from the func release page.

  2. Rename the binary to kn-func, and make it executable by running the following commands:

    1. mv <path-to-binary-file> kn-func
    1. chmod +x kn-func

    Where <path-to-binary-file> is the path to the binary file you downloaded in the previous step, for example, func_darwin_amd64 or func_linux_amd64.

  3. Move the executable binary file to a directory on your PATH by running the command:

    1. mv kn-func /usr/local/bin
  4. Verify that the CLI is working by running the command:

    1. kn func version