diff --git a/config/redirects.yml b/config/redirects.yml
index 1a15338fbf..095e362964 100644
--- a/config/redirects.yml
+++ b/config/redirects.yml
@@ -240,3 +240,7 @@ plugins:
versioned/getting-started/clean-up.md: versioned/getting-started/next-steps.md#clean-up
versioned/bookstore/disclaimer/README.md: versioned/bookstore/disclaimer/disclaimer.md
versioned/bookstore/extra-challenge/README.md: versioned/bookstore/extra-challenge/extra-challenges.md
+ versioned/functions/install-func.md: versioned/functions/running-functions.md
+ versioned/functions/creating-functions.md: versioned/functions/running-functions.md
+ versioned/functions/invoking-functions.md: versioned/functions/running-functions.md
+ versioned/functions/kafka-functions.md: versioned/functions/subscribing-functions.md
diff --git a/docs/versioned/.nav.yml b/docs/versioned/.nav.yml
index c04631218b..3c98e91b6d 100644
--- a/docs/versioned/.nav.yml
+++ b/docs/versioned/.nav.yml
@@ -28,15 +28,11 @@ nav:
###############################################################################
- Functions:
- Overview: functions/README.md
- - Install: functions/install-func.md
- - Create: functions/creating-functions.md
- - Build: functions/building-functions.md
- - Run locally: functions/running-functions.md
- - Deploy: functions/deploying-functions.md
- - Invoke: functions/invoking-functions.md
- - Subscribe to events: functions/subscribing-functions.md
- - Kafka: functions/kafka-functions.md
- - Language packs: functions/language-packs.md
+ - Develop locally: functions/running-functions.md
+ - Build an image: functions/building-functions.md
+ - Deploy a function: functions/deploying-functions.md
+ - Connect events: functions/subscribing-functions.md
+ - Templates and runtimes: functions/language-packs.md
###############################################################################
# Serving
###############################################################################
diff --git a/docs/versioned/client/README.md b/docs/versioned/client/README.md
index c05df275ee..28700ce25f 100755
--- a/docs/versioned/client/README.md
+++ b/docs/versioned/client/README.md
@@ -37,7 +37,7 @@ The `func` CLI enables you to create, build, and deploy Knative Functions withou
### Additional resources
-- See [Installing Knative Functions](../functions/install-func.md).
+- See [Develop locally — Prepare](../functions/running-functions.md#prepare).
- See the [`func` documentation]({{ funcdocs() }}){target=_blank} in Github.
## Connecting CLI tools to your cluster
diff --git a/docs/versioned/functions/README.md b/docs/versioned/functions/README.md
index 70f9fc91d6..7bdb8d08fa 100644
--- a/docs/versioned/functions/README.md
+++ b/docs/versioned/functions/README.md
@@ -3,26 +3,31 @@ audience: developer
components:
- functions
function: explanation
+hide_prev: true
+hide_next: true
---
-# Knative Functions overview
+# Knative Functions
--8<-- "about-functions.md"
-## Function templates
+## Start here
---8<-- "functions-templates-intro.md"
+New to Knative Functions? Follow [Try Functions](../getting-started/about-knative-functions.md)
+to create, edit, and test a Go function locally — no Kubernetes cluster or
+registry account required.
-## Language packs
+## Choose a task
-Functions can be written in any language supported by the available [language packs](https://github.com/knative/func/blob/main/docs/language-packs/language-pack-contract.md){target=_blank}.
-
+- **[Develop locally](running-functions.md):** install `func`, create a project,
+ run it locally, and send HTTP or CloudEvents test requests.
+- **[Build an image](building-functions.md):** build a container image locally
+ without running or deploying it.
+- **[Deploy a function](deploying-functions.md):** deploy from your machine or
+ build and deploy remotely on a cluster with Tekton.
+- **[Connect events](subscribing-functions.md):** subscribe a function to a
+ Knative Broker with Triggers, or consume Apache Kafka topics via sidecar.
+- **[Templates and runtimes](language-packs.md):** choose a language and
+ HTTP/CloudEvents template, or use custom language-pack repositories.
-## Getting started with functions
-
-Follow [Get started with Functions](../getting-started/about-knative-functions.md)
-to create, change, and test a Go function locally. This is the same Functions
-track linked from Get Started. Cluster deployment is optional and links to the
-shared learning-cluster setup.
-
-For an existing project, use the how-to guides in this section.
+For the full CLI reference, see the [`func` documentation]({{ funcdocs() }}){target=_blank}.
diff --git a/docs/versioned/functions/building-functions.md b/docs/versioned/functions/building-functions.md
index 7bca01c18f..ad1269179e 100644
--- a/docs/versioned/functions/building-functions.md
+++ b/docs/versioned/functions/building-functions.md
@@ -3,136 +3,81 @@ audience: developer
components:
- functions
function: how-to
+hide_prev: true
+hide_next: true
---
-# Building functions
+# Build an image
-Build a container image from an existing function project. The local procedure
-builds only: it does not run, publish, or deploy the function. The optional
-on-cluster workflow below builds **and deploys**, so choose it only when you want
-that result.
+`func build` turns a function project into a container image. It does not push
+anything to a registry by default (add `--push` to push the image), and it never
+deploys. For standard deployments, skip this separate build step:
+[`func deploy`](deploying-functions.md) builds, pushes, and deploys in one command.
-## Local builds
+## Requirements
-### Prerequisites
+- An initialized function project containing `func.yaml` and source code.
+ [Create a project](running-functions.md#create-a-project) if needed.
+- A running Docker-compatible container engine, such as
+ [Docker](https://docs.docker.com/get-started/get-docker/) or
+ [Podman](https://github.com/knative/func/blob/main/docs/building-functions/podman.md){target=_blank},
+ for containerized builders (`pack` or `s2i`).
+- Run commands from inside the function project directory (or use `--path`).
-- You have an initialized function project containing `func.yaml` and its source.
- [Create a project](creating-functions.md) if needed.
-- Docker is running for the container-based buildpacks builder used here.
-- Run these commands from that project directory, not its parent directory.
+
-### Procedure
+## Build
-Set an explicit local image name so the build does not need a registry prompt:
+Pass your registry: the registry host and your account namespace, for example
+`ghcr.io/alice` or `docker.io/alice`:
=== "func"
```bash
- func build --builder pack \
- --image localhost/my-function:latest
+ func build --registry
```
=== "kn func"
```bash
- kn func build --builder pack \
- --image localhost/my-function:latest
+ kn func build --registry
```
-`my-function` is an example image name; substitute yours consistently if desired.
-`localhost` here is a local tag, not a registry server you must create. Wait for
-building to complete, then check the image in Docker:
+`func` names the image `/:latest` and saves the registry
+in `func.yaml`, so later builds and deploys need no registry flag. You can also
+set the registry with `FUNC_REGISTRY`. The image stays in your container engine's
+local image store until you push it. If you previously set `--image`, see
+[Set the image name yourself](#set-the-image-name-yourself) to return to registry-based naming.
-```bash
-docker image ls localhost/my-function:latest
-```
-
-A row with the tag `latest` and an image ID identifies the built image. This does
-not mean it was pushed or started. For publishing, see the
-[deployment guide](deploying-functions.md#procedure), which explains registry
-prefixes and full image destinations. [Try Functions](../getting-started/about-knative-functions.md#run-and-test)
-shows how to run and test an image as a separate step. For other builders, image
-naming options, and flags, see the [func build reference](https://github.com/knative/func/blob/main/docs/reference/func_build.md).
-
-## On-cluster Builds
-
-This alternative uses a remote pipeline and deploys the resulting function.
-It avoids a local container build, but requires a configured cluster and registry
-credentials. The source can come from Git **or** direct upload; Git is not required
-for the direct-upload branch.
-
-### Prerequisites
-
-- Your kubeconfig selects a cluster with Knative Serving installed.
-- Tekton Pipelines and the function build pipeline are configured according to the
- [on-cluster build setup guide](https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md).
-- The pipeline can push to your chosen registry, and the cluster can pull the image.
- Complete the registry/credential setup in that guide rather than assuming local
- Docker login alone configures every remote pipeline.
-- You have an initialized local function project and are in its directory.
-
-### Procedure
-
-Choose the source branch below. Replace `REGISTRY-USER` with your Docker Hub
-account namespace in the image name. For Git, separately replace `GIT-OWNER` and
-`GIT-REPO` with the repository owner and name; the Git owner need not match your
-registry account. The explicit image destination avoids carrying over a local-only
-tag from an earlier build.
-
-#### Git-backed source
-
-The function project must be committed in a Git repository the pipeline can read.
-For a private repository, your platform administrator must provision pipeline
-access before you use this branch; the linked function-build setup guide does
-not provide a private-Git authentication recipe. The [Tekton authentication guide](https://tekton.dev/docs/pipelines/auth/)
-is background for that platform setup. If you cannot arrange repository access,
-use direct upload instead.
-
-These commands assume the project is at the repository root. For a subdirectory,
-set `build.source.dir` in your project's `func.yaml` to its relative path, following
-the configuration example in the [on-cluster build guide](https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md).
-For example, `dir: functions/my-function` selects that directory within the Git repository.
-
-=== "func"
+## Verify the image
- ```bash
- func deploy --remote \
- --image docker.io/REGISTRY-USER/my-function:latest \
- --git-url https://github.com/GIT-OWNER/GIT-REPO
- ```
-
-=== "kn func"
+Confirm the image exists (with Podman, use `podman image ls`):
- ```bash
- kn func deploy --remote \
- --image docker.io/REGISTRY-USER/my-function:latest \
- --git-url https://github.com/GIT-OWNER/GIT-REPO
- ```
+```bash
+docker image ls /
+```
-#### Direct-upload source
+A row with tag `latest` and an image ID confirms the build succeeded.
-Use this branch to upload the current local project. No Git repository is required.
-Passing an empty Git URL explicitly clears a previously configured Git source.
-If you previously set `build.source.dir` for a Git subdirectory, remove that `dir`
-entry from `build.source` too so the upload uses the current local project root:
+
-=== "func"
+## Other builders
- ```bash
- func deploy --remote \
- --image docker.io/REGISTRY-USER/my-function:latest \
- --git-url=""
- ```
+`func build` supports `--builder pack` (Cloud Native Buildpacks, the default),
+`--builder s2i` (Source-to-Image), and `--builder host`, which builds with your
+local toolchain and needs no container engine. The `host` builder currently
+supports Go and Python functions. It writes the image to `.func/build/oci`
+in the project, not to the container engine, so `docker image ls` does not list it.
-=== "kn func"
+For remote on-cluster builds with Tekton, see
+[Deploy a function — Build and deploy remotely](deploying-functions.md#build-and-deploy-remotely).
+For all flags and builder options, see the
+[`func build` reference](https://github.com/knative/func/blob/main/docs/reference/func_build.md){target=_blank}.
- ```bash
- kn func deploy --remote \
- --image docker.io/REGISTRY-USER/my-function:latest \
- --git-url=""
- ```
+## Set the image name yourself
-Wait for the pipeline and deployment to finish. Verify the **deployed** function
-using `func invoke --target remote` (or `kn func invoke --target remote`) and
-check your function's expected response. A finished image build alone does not
-prove deployment or invocation succeeded.
+To choose the full image name instead of `/:latest`,
+pass `--image`, for example `--image ghcr.io/alice/my-image:v1`. `func` saves it
+in the `image:` line in `func.yaml`, where it takes precedence over `--registry`
+and `FUNC_REGISTRY` on later builds and deploys. To return to registry-based
+naming, delete the `image:` line from `func.yaml`.
diff --git a/docs/versioned/functions/creating-functions.md b/docs/versioned/functions/creating-functions.md
deleted file mode 100644
index c34be4b926..0000000000
--- a/docs/versioned/functions/creating-functions.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-audience: developer
-components:
- - functions
-function: how-to
----
-
-# Creating functions
-
---8<-- "create-a-function.md"
diff --git a/docs/versioned/functions/deploying-functions.md b/docs/versioned/functions/deploying-functions.md
index 62b578d60d..4e42bd8758 100644
--- a/docs/versioned/functions/deploying-functions.md
+++ b/docs/versioned/functions/deploying-functions.md
@@ -3,36 +3,143 @@ audience: developer
components:
- functions
function: how-to
+hide_prev: true
+hide_next: true
---
-# Deploying functions
+# Deploy a function
---8<-- "deploy-func-intro.md"
+Build, push, and deploy a function project to Kubernetes as a Knative Service
+(or as a raw Kubernetes Deployment). For a guided first deployment, see
+[Try Functions — Deploy to Knative](../getting-started/about-knative-functions.md#deploy-to-knative-optional).
-## Prerequisites
+## Requirements
-- You have a Kubernetes cluster with Knative Serving installed, and your kubeconfig
- selects the intended cluster and namespace. For a disposable environment,
- [set up a learning cluster](../getting-started/quickstart-install.md) and check
- its context before returning here. Local Functions development alone does not
- create a cluster.
+- An initialized function project containing `func.yaml`
+ ([create a project](running-functions.md#create-a-project) if needed).
+- A Kubernetes cluster with Knative Serving installed, with your `kubectl`
+ context selecting the target cluster and namespace.
+- Push access to a container registry that your cluster can pull from (use a
+ public repository or configure image pull secrets for private registries).
+- For local builds: a running [Docker](https://docs.docker.com/get-started/get-docker/)
+ engine. For remote builds: Tekton Pipelines configured on the cluster.
-- You have a Docker daemon running on your local machine for the container builder.
- Quickstart uses an existing container engine; it does not install one.
+## Deploy from your machine
-- You have access to a container registry and are able to push images to this registry. Note that some image registries set newly pushed images to private by default. If you are deploying a function for the first time, you may need to ensure that your images are set to public.
+Run `func deploy` from inside the project directory and pass your registry: the
+registry host and your account namespace, for example `ghcr.io/alice` or
+`docker.io/alice`. There is no need to run `func build` first. If you previously
+passed `--image` (an exact image name), `func.yaml` keeps that name in an `image:`
+line, which takes precedence over `--registry` until you delete the line.
-## Procedure
+=== "func"
-For a first deployment, follow the [worked deployment tutorial](../getting-started/about-knative-functions.md#deploy-to-knative-optional),
-which covers cluster setup, registry login, and the full image name. This is also
-the next step if you are coming from the local Functions track.
+ ```bash
+ func deploy --registry
+ ```
-In the commands below, `` means the registry **and your account namespace**.
-For example, `docker.io/alice` means Alice's Docker Hub namespace, and
-`ghcr.io/alice` means her GitHub Container Registry namespace. Substitute your own
-account; do not type the angle brackets. The CLI uses that prefix with the
-function's project name to construct the image name. The worked tutorial instead
-uses `--image` to set the complete destination explicitly.
+=== "kn func"
---8<-- "proc-deploying-function.md"
+ ```bash
+ kn func deploy --registry
+ ```
+
+`func` builds the image, pushes it to `/:latest`, and
+creates or updates a Knative Service with the project name.
+
+- **Namespace:** By default, `func deploy` uses the previously deployed
+ namespace recorded in the project, or your current `kubectl` namespace on
+ first deploy. Pass `-n ` to target a specific namespace.
+- **Private registries:** Set `FUNC_USERNAME` and `FUNC_PASSWORD` environment
+ variables for registry push credentials (avoid passing `--password` on the
+ command line), and ensure the target cluster namespace has pull credentials.
+- **Raw Kubernetes deployer:** Add `--deployer raw` to deploy as a standard
+ Kubernetes Deployment and Service instead of a Knative Service.
+
+## Build and deploy remotely
+
+Use `--remote` to run the build and deployment on the cluster with Tekton
+Pipelines instead of a local Docker engine. Configure Tekton and pipeline RBAC
+first using the
+[on-cluster build guide](https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md){target=_blank}.
+
+The following commands use the source flags introduced in `func` v1.24.0.
+Before v1.24.0, `--source`, `--revision`, and `--source-dir` were named
+`--git-url`, `--git-branch`, and `--git-dir`, respectively.
+
+Choose one source method (replace `REGISTRY-USER` with your registry account
+namespace):
+
+=== "Git-backed source"
+
+ Commit your project to a Git repository the cluster pipeline can read. For
+ private repositories, have your platform administrator provision pipeline
+ Git access first (see the
+ [Tekton authentication guide](https://tekton.dev/docs/pipelines/auth/){target=_blank}).
+ If the project is in a subdirectory, add `--source-dir `.
+ To select a branch, tag, or commit, add `--revision `.
+
+ ```bash
+ func deploy --remote \
+ --registry docker.io/REGISTRY-USER \
+ --source https://github.com/GIT-OWNER/GIT-REPO
+ ```
+
+ With an explicit `--source`, `func` deploys the function by reference from
+ the repository and does not write to the local `func.yaml`. Do not combine
+ `--source` with `--image`; use `--registry` instead. Re-run the same command
+ with `--source` for subsequent Git-backed deployments.
+
+=== "Direct upload (no Git)"
+
+ Upload the current local project directory directly. Passing `--source=""`
+ and `--source-dir=""` clears any previously configured Git repository and
+ subdirectory:
+
+ ```bash
+ func deploy --remote \
+ --registry docker.io/REGISTRY-USER \
+ --source="" --source-dir=""
+ ```
+
+(`kn func deploy` accepts the same flags.)
+
+## Verify
+
+Invoke the deployed function with an explicit `--target remote` so you do not
+accidentally hit a locally running instance:
+
+=== "func"
+
+ ```bash
+ func invoke --target remote
+ ```
+
+=== "kn func"
+
+ ```bash
+ kn func invoke --target remote
+ ```
+
+Confirm the response body matches your function's expected output. You can also
+check status on the cluster:
+
+- **Knative deployer (default):** `kn service describe -n `
+- **Raw deployer (`--deployer raw`):** `kubectl get deployment/ service/ -n `
+
+## Update and remove
+
+- **Update:**
+ - Local builds and direct-upload remote builds: edit your code and re-run
+ `func deploy` (or `func deploy --remote --source="" --source-dir=""`).
+ - Git-backed remote builds: commit and push your changes to the Git
+ repository first, then re-run the same `func deploy --remote --source ...`
+ command, including any `--revision` and `--source-dir` flags.
+ - With the default Knative deployer, each deploy rolls out a new Revision;
+ with `--deployer raw`, it updates the Kubernetes Deployment.
+- **Remove:** Run `func delete` from inside the project directory (works for
+ both Knative and raw deployers). You can also delete directly with
+ `kn service delete -n ` (Knative deployer) or
+ `kubectl delete deployment/ service/ -n ` (raw
+ deployer). Deleting the workload does not delete the pushed image from your
+ container registry.
diff --git a/docs/versioned/functions/install-func.md b/docs/versioned/functions/install-func.md
deleted file mode 100644
index ad5aca0330..0000000000
--- a/docs/versioned/functions/install-func.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-audience: developer
-components:
- - functions
-function: how-to
----
-
-# Installing Knative Functions
-
---8<-- "install-functions-intro.md"
-
-## Installing the `func` CLI
-
---8<-- "install-func-CLI.md"
-
-## Installing the `kn func` CLI plugin
-
---8<-- "install-kn-func-plugin.md"
diff --git a/docs/versioned/functions/invoking-functions.md b/docs/versioned/functions/invoking-functions.md
deleted file mode 100644
index da8d92b930..0000000000
--- a/docs/versioned/functions/invoking-functions.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-audience: developer
-components:
- - functions
-function: how-to
----
-
-# Invoking functions
-
-You can use the `func invoke` command to send a test request to invoke a
-function either locally or on your Knative cluster.
-
-This command can be used to test that a function is working and able to receive HTTP requests and CloudEvents correctly.
-
-If your function is running locally, `func invoke` sends a test request to the local instance.
-
-You can use the `func invoke` command to send test data to your function with the `--data` flag, as well as other options to simulate different types of requests. See the [func invoke](https://github.com/knative/func/blob/main/docs/reference/func_invoke.md){target=_blank} documentation for more information.
diff --git a/docs/versioned/functions/kafka-functions.md b/docs/versioned/functions/kafka-functions.md
deleted file mode 100644
index 66cbcbef7b..0000000000
--- a/docs/versioned/functions/kafka-functions.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-audience: developer
-components:
- - functions
-function: explanation
----
-
-# Kafka functions
-
-A function can consume messages from an Apache Kafka topic. When a function declares a `run.kafka` configuration, `func` deploys a language-agnostic runtime sidecar alongside it. The sidecar consumes the topic and delivers each record to the function as a CloudEvent over HTTP, so the function stays a plain CloudEvents handler in any language, with no Kafka client code of its own.
-
-The full guide lives in the `func` repository, covering concepts, a getting-started walkthrough, delivery and retries, deployment and scaling, idempotency, local development, and troubleshooting:
-
-- [Kafka functions guide](https://github.com/knative/func/blob/main/docs/kafka-functions/README.md){target=_blank}
-- [run.kafka configuration reference](https://github.com/knative/func/blob/main/docs/reference/func_yaml.md#runkafka){target=_blank}
diff --git a/docs/versioned/functions/language-packs.md b/docs/versioned/functions/language-packs.md
index 0322039ed8..431011aee5 100644
--- a/docs/versioned/functions/language-packs.md
+++ b/docs/versioned/functions/language-packs.md
@@ -3,19 +3,84 @@ audience: developer
components:
- functions
function: how-to
+hide_prev: true
+hide_next: true
---
-# Language packs
+# Templates and runtimes
-Language packs can be used to extend Knative Functions to support additional runtimes, function signatures, operating systems, and installed tooling for functions. Language Packs are distributed through Git repositories or as a directory on a disc.
+Knative Functions includes built-in language runtimes and templates, and lets
+you pull custom templates from Git repositories via language packs.
-For more information see the [language pack](https://github.com/knative/func/blob/main/docs/language-packs/language-pack-contract.md){target=_blank} documentation.
+## Choose a runtime
-## Using external Git repositories
+Pass `-l ` to `func create`. Built-in runtimes:
-When creating a new function, a Git repository can be specified as the source
-for the template files.
+| Runtime | `-l` value |
+| --- | --- |
+| Go | `go` |
+| Node.js | `node` |
+| TypeScript | `typescript` |
+| Python | `python` |
+| Quarkus (Java) | `quarkus` |
+| Spring Boot (Java) | `springboot` |
+| Rust | `rust` |
-## Installing language packs locally
+## Choose HTTP or CloudEvents
-Language packs can be installed locally by using the [`func repository`](https://github.com/knative/func/blob/main/docs/reference/func_repository.md){target=_blank} command.
+Pass `-t ` to `func create` (default `http`):
+
+- **`http`** — handles standard HTTP requests and responses.
+- **`cloudevents`** — receives and optionally returns CloudEvents; use this
+ when connecting a function to Knative Eventing or Kafka.
+
+```bash
+func create -l python -t cloudevents my-event-fn
+```
+
+## Use an external repository
+
+To scaffold a function from a remote Git template repository without installing
+it locally, pass `--repository`:
+
+```bash
+func create -l go \
+ --template \
+ --repository \
+ my-function
+```
+
+Verify the generated `my-function/` directory contains `func.yaml` and the
+expected template files.
+
+## Installed repositories { #manage-installed-repositories }
+
+Install a trusted template repository locally with `func repository` so you can
+reuse its templates by name:
+
+1. Add the repository and verify it appears in the list:
+
+ ```bash
+ func repository add my-pack
+ func repository list
+ ```
+
+ The output lists `default` alongside `my-pack`.
+
+1. Create a function using `/`:
+
+ ```bash
+ func create -l go -t my-pack/ my-function
+ ```
+
+1. Rename or remove installed repositories when needed:
+
+ ```bash
+ func repository rename my-pack renamed-pack
+ func repository remove renamed-pack
+ ```
+
+For all repository flags, see the
+[`func repository` reference](https://github.com/knative/func/blob/main/docs/reference/func_repository.md){target=_blank}.
+To author your own language pack, see the
+[language pack contract](https://github.com/knative/func/blob/main/docs/language-packs/language-pack-contract.md){target=_blank}.
diff --git a/docs/versioned/functions/running-functions.md b/docs/versioned/functions/running-functions.md
index db19a8ab72..8fda229d02 100644
--- a/docs/versioned/functions/running-functions.md
+++ b/docs/versioned/functions/running-functions.md
@@ -3,16 +3,165 @@ audience: developer
components:
- functions
function: how-to
+hide_prev: true
+hide_next: true
---
-# Running functions
+# Develop locally
---8<-- "run-func-intro.md"
+Install the `func` CLI, scaffold a function project, run it on your machine,
+and test it with HTTP or CloudEvents requests — no Kubernetes cluster or
+container registry required.
-## Prerequisites
+
-- You have a Docker daemon on your local machine. This is already provided if you have used the Quickstart installation.
+## Prepare
-## Procedure
+- A running [Docker](https://docs.docker.com/get-started/get-docker/) engine
+ for containerized builds (`pack` or `s2i`). For `--builder host`, Docker is
+ optional, but the target language toolchain (Go or Python) must be installed
+ on your host.
+- Install the `func` CLI (or `kn func` plugin):
---8<-- "proc-running-function.md"
+=== "Homebrew"
+
+ ```bash
+ brew install knative-extensions/kn-plugins/func
+ ```
+
+ If `kn` is also installed via Homebrew, `kn func` is available automatically.
+
+=== "Release binary"
+
+ Download the binary for your OS and architecture from the
+ [`func` release page](https://github.com/knative/func/releases){target=_blank},
+ make it executable, and place it on your `PATH` as `func` (or as `kn-func`
+ to use it as a `kn` plugin).
+
+=== "Build from source"
+
+ Requires Go and `make`:
+
+ ```bash
+ git clone https://github.com/knative/func.git func
+ cd func
+ make
+ ```
+
+ Place the resulting `func` binary on your `PATH`.
+
+Verify the installation using the command matching how you installed it:
+
+```bash
+func version
+# or, if installed as a kn plugin:
+kn func version
+```
+
+
+
+## Create a project
+
+Create a new function directory using `-l` (language) and `-t` (template:
+`http` or `cloudevents`, default `http`). See
+[Templates and runtimes](language-packs.md) for the full list of supported
+languages.
+
+=== "func"
+
+ ```bash
+ func create -l go -t http my-function
+ cd my-function
+ ```
+
+=== "kn func"
+
+ ```bash
+ kn func create -l go -t http my-function
+ cd my-function
+ ```
+
+`func create` writes a new `my-function/` directory containing `func.yaml`,
+handler source, and starter tests. Pass `-t cloudevents` if your function will
+consume CloudEvents. For all flags, see the
+[`func create` reference](https://github.com/knative/func/blob/main/docs/reference/func_create.md){target=_blank}.
+
+## Run locally
+
+Inside the project directory, build and run the function locally. Pass an
+explicit `localhost/...` image name so the build stays local without needing a
+container registry:
+
+=== "func"
+
+ ```bash
+ func run --builder pack \
+ --image localhost/my-function:latest
+ ```
+
+=== "kn func"
+
+ ```bash
+ kn func run --builder pack \
+ --image localhost/my-function:latest
+ ```
+
+`--image` saves this local image name in `func.yaml`. Before deploying with
+`--registry`, delete the `image:` line so the saved local name does not override
+your registry. See [Deploy a function](deploying-functions.md).
+
+Wait until the function prints its local address, for example:
+
+```text
+Function running on 127.0.0.1:8080
+```
+
+Useful flags:
+
+- `--builder host` — run Go or Python directly on your host without Docker.
+- `--build=true` — force a rebuild even if no source changes were detected.
+- `--build=false` — reuse an already-built image without rebuilding (fails if
+ no image has been built yet).
+- `--address 127.0.0.1:8081` — bind to a different local port.
+
+Keep this terminal open while testing.
+
+
+
+## Send test requests
+
+In a **second terminal** inside the same project directory, use `func invoke`
+with `--target local` so you are guaranteed to hit the local instance:
+
+=== "HTTP request"
+
+ ```bash
+ func invoke --target local \
+ --content-type application/json \
+ --data '{"message":"Hello local!"}'
+ ```
+
+=== "CloudEvent"
+
+ ```bash
+ func invoke --target local \
+ --format cloudevent \
+ --type dev.knative.example \
+ --source /local-test \
+ --data '{"message":"Hello event!"}'
+ ```
+
+(`kn func invoke` accepts the same flags.) Confirm the response body matches
+your handler's output. You can also target a deployed instance with
+`--target remote` or an arbitrary endpoint with `--target https://...`. See the
+[`func invoke` reference](https://github.com/knative/func/blob/main/docs/reference/func_invoke.md){target=_blank}
+for all options.
+
+## Iterate and stop
+
+1. Press ++ctrl+c++ in the `func run` terminal to stop the local function.
+2. Edit your handler code and save.
+3. Re-run `func run` and verify the updated output with `func invoke --target local`.
+
+When you are ready to package or ship the function, continue to
+[Build an image](building-functions.md) or [Deploy a function](deploying-functions.md).
diff --git a/docs/versioned/functions/subscribing-functions.md b/docs/versioned/functions/subscribing-functions.md
index 41d4874933..00499b06f6 100644
--- a/docs/versioned/functions/subscribing-functions.md
+++ b/docs/versioned/functions/subscribing-functions.md
@@ -2,43 +2,114 @@
audience: developer
components:
- functions
+ - eventing
function: how-to
+hide_prev: true
+hide_next: true
---
-# Subscribe functions to CloudEvents
+# Connect events
-### Prerequisites
+Deliver events to a function either through a Knative Eventing **Broker** and
+**Trigger**, or directly from an **Apache Kafka** topic using a runtime sidecar.
-- Knative Eventing installed on the cluster
+## Broker subscription { #configure-a-broker-subscription }
-### Procedure
+**Requirements (Broker path):**
---8<-- "proc-subscribe-function.md"
+- An initialized function project using the `cloudevents` template
+ (`func create -l -t cloudevents `), with a handler that logs
+ or otherwise makes received events observable.
+- A Kubernetes cluster with Knative Serving and Knative Eventing installed, and
+ a ready Broker in your target namespace (for example `default`, or
+ `example-broker` if reusing a Quickstart cluster).
+- Registry push and cluster pull access as described in
+ [Deploy a function](deploying-functions.md#requirements).
-### Deployment with Triggers
+`func subscribe` records event subscription filters in `func.yaml` — it does
+not modify the cluster until you deploy.
-When invoking `func deploy` the CLI will create Knative Triggers for the function.
+Pass `--source` with your Broker's name (if omitted, `func` defaults to a
+Broker named `default`) and one or more `--filter` key/value pairs (all filters
+must match):
=== "func"
- Deploy the function with Triggers by running the command inside the project directory:
-
```bash
- func deploy
+ func subscribe \
+ --source example-broker \
+ --filter type=dev.knative.example
```
=== "kn func"
- Deploy the function with Triggers by running the command inside the project directory:
+ ```bash
+ kn func subscribe \
+ --source example-broker \
+ --filter type=dev.knative.example
+ ```
+
+Repeat `--filter key=value` to require additional CloudEvent attributes or
+extensions. To change or remove subscriptions later, edit `deploy.subscriptions`
+in `func.yaml` and redeploy.
+
+## Deploy and verify delivery
+
+Use the same target namespace (``) for deployment, Trigger checks,
+and logs (pass `-n ` consistently if you are not using the current
+context's namespace).
+
+1. Deploy from inside the project directory. `func deploy` creates or updates
+ the Knative Service and creates the matching Knative Triggers on the cluster:
+
+ ```bash
+ func deploy --registry -n
+ ```
+
+1. Confirm the generated Trigger is ready (`READY=True`):
```bash
- kn func deploy
+ kn trigger list -n
```
-!!! Success "Expected output"
- ```{ .bash .no-copy }
- 🙌 Function image built: /hello:latest
- 🎯 Creating Triggers on the cluster
- ✅ Function deployed in namespace "default" and exposed at URL:
- http://hello.default.127.0.0.1.sslip.io
+1. Send a matching CloudEvent (`type: dev.knative.example`) to `example-broker`
+ — for example using the CloudEvents Player from
+ [Try Eventing](../getting-started/getting-started-eventing.md) or another
+ event source connected to that Broker.
+
+1. Verify your function received the event by checking its pod logs (or other
+ observable effect from your handler):
+
+ ```bash
+ kubectl logs -n \
+ -l serving.knative.dev/service= -c user-container
```
+
+ Confirm your handler logged the event's ID and payload. Direct
+ `func invoke` calls the function directly and does not verify Broker
+ routing or Trigger filters.
+
+
+
+## Consume Kafka records
+
+A function can also consume records directly from an Apache Kafka topic without
+a Knative Eventing Broker. When `func.yaml` declares a `run.kafka`
+configuration, `func` deploys a language-agnostic sidecar that consumes the
+topic and delivers each record to your function as a CloudEvent over HTTP, so
+your function needs no Kafka client code.
+
+**Requirements (Kafka path):**
+
+- An initialized `cloudevents` function project and container registry push/pull
+ access.
+- An accessible Apache Kafka cluster and topic.
+- The **KEDA** or **raw** deployer — direct Kafka consumption (`run.kafka`) is
+ **not** supported with the default Knative Serving deployer (KEDA requires
+ KEDA installed on the cluster).
+
+For the full walkthrough — including concepts, delivery and retries, scaling,
+idempotency, local development, and troubleshooting — see the upstream guides:
+
+- [Kafka functions guide](https://github.com/knative/func/blob/main/docs/kafka-functions/README.md){target=_blank}
+- [`run.kafka` configuration reference](https://github.com/knative/func/blob/main/docs/reference/func_yaml.md#runkafka){target=_blank}
diff --git a/docs/versioned/getting-started/about-knative-functions.md b/docs/versioned/getting-started/about-knative-functions.md
index 724c280276..609c4f1bf7 100644
--- a/docs/versioned/getting-started/about-knative-functions.md
+++ b/docs/versioned/getting-started/about-knative-functions.md
@@ -37,7 +37,7 @@ required for the local workflow.
`func`.
Verify `func version` prints a version number. For `kn func` plugin installation,
-see [Installing Knative Functions](../functions/install-func.md).
+see [Develop locally — Prepare](../functions/running-functions.md#prepare).
@@ -73,7 +73,9 @@ see [Installing Knative Functions](../functions/install-func.md).
The first build downloads builder images and dependencies and can take
several minutes. `localhost/hello-function:latest` is a local image name —
- nothing is pushed or deployed. Wait for a line like:
+ nothing is pushed or deployed. `func` saves this name in the `image:` line
+ in `func.yaml`; the optional deployment below clears it before selecting
+ a registry. Wait for a line like:
```text
Function running on 127.0.0.1:8080
@@ -108,13 +110,23 @@ You have finished the local workflow. To run the same function on Knative, you n
- A learning cluster — [set up a cluster](quickstart-install.md) if you do not have one, and confirm your [context and `default` namespace](quickstart-install.md#create-and-verify).
- Access to a container registry (logged in locally) with push permissions and a public image repository so the cluster can pull the image without pull secrets. Never include secrets in the project.
-1. From `hello-function`, build, push, and deploy (replace `` with your registry and namespace, for example `ghcr.io/alice` or `docker.io/alice`):
+1. Stop the locally running function with ++ctrl+c++. Inside `hello-function`,
+ open `func.yaml` and delete the `image:` line containing
+ `localhost/hello-function:latest`. A saved image name takes precedence over
+ `--registry`, so leaving it would keep the local-only name.
+
+1. Build, push, and deploy in one command—there is no need to run `func build`
+ first. Replace `` with your registry host and account namespace,
+ for example `ghcr.io/alice` or `docker.io/alice`:
```bash
- func deploy --builder pack \
- --image /hello-function:latest
+ func deploy --builder pack --registry
```
+ `func` builds and pushes `/hello-function:latest`, then creates
+ the Knative Service. It saves the registry in `func.yaml`, so subsequent
+ deployments can use `func deploy` without a registry flag.
+
1. Invoke the remote Service explicitly:
```bash