Deploying functions

Deploying a function creates an OCI container image for your function, and pushes this container image to your image registry. The function is deployed to the cluster as a Knative Service. Redeploying a function updates the container image and resulting Service that is running on your cluster. Functions that have been deployed to a cluster are accessible on the cluster just like any other Knative Service.

Prerequisites

  • You have a Docker daemon on your local machine. This is already provided if you have used the Quickstart installation.

  • You have access to a container registry and are able to push images to this registry.

Procedure

The deploy command uses the function project name as the Knative Service name. When the function is built, the project name and the image registry name are used to construct a fully qualified image name for the function.

funckn func

Deploy the function by running the command inside the project directory:

  1. func deploy --registry <registry>

Deploy the function by running the command inside the project directory:

  1. kn func deploy --registry <registry>

Expected output

  1. 🙌 Function image built: <registry>/hello:latest
  2. Function deployed in namespace "default" and exposed at URL:
  3. http://hello.default.127.0.0.1.sslip.io

You can verify that your function has been successfully deployed by using the invoke command and observing the output:

funckn func

  1. func invoke
  1. kn func invoke

Expected output

  1. Received response
  2. POST / HTTP/1.1 hello.default.127.0.0.1.sslip.io
  3. User-Agent: Go-http-client/1.1
  4. Content-Length: 25
  5. Accept-Encoding: gzip
  6. Content-Type: application/json
  7. K-Proxy-Request: activator
  8. X-Request-Id: 9e351834-0542-4f32-9928-3a5d6aece30c
  9. Forwarded: for=10.244.0.15;proto=http
  10. X-Forwarded-For: 10.244.0.15, 10.244.0.9
  11. X-Forwarded-Proto: http
  12. Body: