Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 55 additions & 47 deletions docs/tutorials/knative.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,81 @@
# Knative + urunc: Deploying Serverless Unikernels

This guide walks you through deploying [Knative Serving](https://knative.dev/)
using [`urunc`](https://github.com/urunc-dev/urunc). You’ll build Knative from
a custom branch and use [`ko`](https://github.com/ko-build/ko) for seamless
image building and deployment.
with urunc support on Kubernetes. We provide pre-built binaries for quick setup,
or you can build Knative from source using [`ko`](https://github.com/ko-build/ko)
for custom configurations.

## Prerequisites

- A running Kubernetes cluster
- `urunc` installed (follow the [installation guide](https://urunc.io/tutorials/How-to-urunc-on-k8s/))

## Install Knative Serving

### Option 1: Use Pre-built Knative (Recommended)

Apply the pre-built Knative manifests with urunc support:

```bash
kubectl apply -f https://s3.nbfc.io/knative/knative-v[[ versions.knative ]]-urunc-5220308.yaml
```

> Note: There are cases where due to the large manifests, kubectl fails. Try a second time, or use `kubectl create -f https://s3.nbfc.io/knative/knative-v[[ versions.knative ]]-urunc-5220308.yaml`

### Option 2: Build Knative from Source

If you prefer to build Knative yourself, follow these steps.

#### Prerequisites for building from source

- A Docker-compatible registry (e.g. Harbor, Docker Hub)
- Ubuntu 20.04 or newer
- Basic `git`, `curl`, `kubectl`, and `docker` installed

## Environment Setup

Install [Docker](/quickstart/#install-docker), Go >= 1.21, and `ko`:
#### Environment Setup

### Install Go 1.21
Install [Docker](/quickstart/#install-docker), Go [[ versions.go ]], and `ko`:
Copy link

@7h3-3mp7y-m4n 7h3-3mp7y-m4n Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have already menionted about docker in the prerequisites, so why don't we add docker install link directly to it? Also its duplication (A suggestion)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the prerequisites, we mention a A Docker-compatible registry and docker is required due to ko (AFAIK).


```bash
sudo mkdir /usr/local/go1.21
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
sudo tar -zxvf go1.21.5.linux-amd64.tar.gz -C /usr/local/go1.21/
rm go1.21.5.linux-amd64.tar.gz
```
##### Install Go (≥ 1.23)

### Verify Go installation (Should be 1.21.5)
Please follow the official [Go installation instructions](https://go.dev/doc/install) to install Go 1.23 or newer.

##### Verify Go installation

```console
$ export GOROOT=/usr/local/go1.21/go
$ export PATH=$GOROOT/bin:$PATH
$ export PATH=/usr/local/go/bin:$PATH
$ export GOPATH=$HOME/go
$ go version
go version go1.21.5 linux/amd64
```
Comment on lines +39 to 49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should list Go ≥ 1.23 under Prerequisites rather than documenting the full installation and verification steps. Since most developers already have Go installed if they are already using knative, it’s enough to state the required version and link to the official installation guide (https://go.dev/doc/install). This keeps the documentation clean, concise, and avoids duplicating upstream instructions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good.


### Install ko VERSION=0.15.1
##### Install ko
```bash
export OS=Linux
export ARCH=x86_64
curl -sSfL "https://github.com/ko-build/ko/releases/download/v${VERSION}/ko_${VERSION}_${OS}_${ARCH}.tar.gz" -o ko.tar.gz
sudo tar -zxvf ko.tar.gz -C /usr/local/bin`
curl -sSfL https://github.com/ko-build/ko/releases/latest/download/ko_Linux_x86_64.tar.gz | sudo tar xzf - -C /usr/local/bin
ko version
```
Comment on lines +51 to 55

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first paragraph of the documentation already says that if we are building from source, we would need ko, so I think we should also put ko in prerequisites, and about the installation guide, I am not sure ( also confused)

Copy link
Contributor

@cmainas cmainas Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should add ko in the prerequisites. If ko provides an installation method rather than from its releases we can point to there, otherwise we can provide the commands to fetch and install ko


## Clone and Build Knative with the queue-proxy patch

### Set your container registry
#### Set your container registry

> Note: You should be able to use dockerhub for this. e.g. `<yourdockerhubid>/knative`
> Note: You should be able to use Docker Hub for this. e.g. `<yourdockerhubid>/knative`

```bash
export KO_DOCKER_REPO='harbor.nbfc.io/nubificus/knative-install-urunc'
export KO_DOCKER_REPO='<your-registry>/knative'
```

### Clone urunc-enabled Knative Serving
#### Clone urunc-enabled Knative Serving and build

```bash
git clone https://github.com/nubificus/serving -b feat_urunc
git clone https://github.com/nubificus/serving -b feat_urunc
cd serving/
ko resolve -Rf ./config/core/ > knative-custom.yaml
```

### Apply knative's manifests to the local k8s
```bash
kubectl apply -f knative-custom.yaml
```
#### Apply knative's manifests to the local k8s

Alternatively, you could use our latest build:
```bash
kubectl apply -f https://s3.nbfc.io/knative/knative-v[[ versions.knative ]]-urunc-5220308.yaml
kubectl apply -f knative-custom.yaml
```

> Note: There are cases where due to the large manifests, kubectl fails. Try a second time, or use `kubectl create -f https://s3.nbfc.io/knative/knative-v[[ versions.knative ]]-urunc-5220308.yaml`

## Setup Networking (Kourier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a link for kourier, people can also reach their website and explore. ( A suggestion)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I get this one.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, adding it like this

## Setup Networking ([Kourier](https://github.com/knative-extensions/net-kourier))


### Install kourier, patch ingress and domain configs
Expand Down Expand Up @@ -121,7 +125,19 @@ kubectl apply -f https://raw.githubusercontent.com/nubificus/c-httpreply/refs/he
kubectl get ksvc -A -o wide
```

### Test the service (replace IP with actual ingress IP)
### Get the ingress IP

Before testing the service, get the IP address of the Kourier internal service:

```bash
kubectl get svc -n kourier-system kourier-internal -o jsonpath='{.spec.clusterIP}'
```

Note the IP address returned (e.g., `10.244.9.220`). You'll use this in the following curl commands.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can write something like this -> This command returns the internal ClusterIP (e.g., 10.244.9.220). Use this value in the next curl command (A suggestion)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let;s just replace "You'll use" with "Use"


### Test the service

Replace `<INGRESS_IP>` with the IP address from the previous step:

```bash
curl -v -H "Host: hellocontainerc.default.127.0.0.1.nip.io" http://<INGRESS_IP>
Expand All @@ -141,9 +157,7 @@ NAME URL LATESTCREA
hellounikernelfc http://hellounikernelfc.default.127.0.0.1.nip.io hellounikernelfc-00001 hellounikernelfc-00001 True
```

and once it's on a `Ready` state, you could issue a request:
> Note: 10.244.9.220 is the IP of the `kourier-internal` svc. You can check your own from:
> `kubectl get svc -n kourier-system |grep kourier-internal`
Once it's in a `Ready` state, invoke the function using the ingress IP you obtained earlier:

```console
$ curl -v -H "Host: hellounikernelfc.default.127.0.0.1.nip.io" http://10.244.9.220:80
Expand All @@ -165,9 +179,3 @@ $ curl -v -H "Host: hellounikernelfc.default.127.0.0.1.nip.io" http://10.244.9.2
Hello, World!
* Connection #0 to host 10.244.9.220 left intact
```

## Wrapping Up

You're now running unikernel-based workloads via Knative and `urunc`! With this
setup, you can push the boundaries of lightweight, secure, and high-performance
serverless deployments — all within a Kubernetes-native environment.