Creating functions

You can create a function by using the kn func create command.

Example command
$ kn func create <path> -r <registry> -l <runtime> -t <trigger> -i <image> -n <namespace> -c

You can specify the runtime, trigger, image, and namespace as flags on the command line, or use the -c flag to start the interactive experience using the CLI prompt.

The value(s) provided for image and registry are persisted to the func.yaml file, so that subsequent invocations do not require the user to specify these again.

Example func.yaml
namespace: default
runtime: node
image: <image_from_registry>
imageDigest: ""
trigger: http
builder: default
envVars: {}
  • Create a Functions project:

    $ kn func create <path> -r <registry> -l <runtime> -t <trigger> -i <image> -n <namespace>

    If the image is unspecified, you will be prompted for a registry name. The image name will be derived from this registry and the function name.

    Example command
    $ kn func create functions/
    Example output
    Project path: /home/user/functions/
    Function name:
    Runtime: go
    Trigger: http