Serverless
Knative
1.What is Knative ?
Knative adds serverless behavior to Kubernetes. It is a CNCF graduated project (TOC vote 2025-09-11, announced 2025-10-08). Latest is v1.24.0.
- Serving : runs HTTP apps that autoscale, even down to zero pods.
- Eventing : routes CloudEvents between producers and consumers.
- Two independent parts, install either one alone.
- Plain Deployment + Service + Ingress + HPA means many YAMLs and no scale to zero.
Try-out sizeOne node, 6 CPUs, 6 GB RAM, 30 GB disk.
Editing the template makes a new immutable Revision. Rollback and traffic split are cheap.
2.Serving : How a Request Flows
The activator holds requests when a Revision has zero pods, wakes it up, then forwards. It also stays in the path while spare room is short: with the default target-burst-capacity of 211, until three idle Pods are ready.
- controllerReconciles Service, Revision, Route.
- activatorBuffers requests at zero pods and on bursts.
- autoscalerReads metrics, sets replicas (KPA).
- queue-proxySidecar in every pod. Counts concurrency.
- webhookValidates and defaults resources.
3.Autoscaling
Default autoscaler is KPA, driven by concurrency or RPS. Scale to zero is on by default.
- Annotations
autoscaling.andknative. dev/ min-scale max-scale. - Cold start : first request waits for a pod. Use min-scale 1 for latency.
- HPA class: serving-hpa.yaml by YAML; the Operator always installs it. CPU needs metrics-server.
| Topic | Deployment + HPA | Knative Service |
|---|---|---|
| Scale to zero | No | Yes (default) |
| Scale signal | CPU / memory | Concurrency or RPS |
| Traffic split | Ingress or mesh tricks | Built in per Revision |
| Rollback | ReplicaSets, manual | Immutable Revisions |
| Objects to write | Deployment, Service, Ingress, HPA | One Service |
| Cold start | None | Yes |
In short : Knative Serving runs an HTTP app as one Service with immutable Revisions and built-in traffic split, and the KPA autoscaler scales it from zero to N.
1.Eventing : Broker and Trigger
Producers do not know consumers. Triggers decouple them.
- SourcePingSource, ApiServerSource, KafkaSource. Turns things into CloudEvents.
- BrokerEvent mailbox in one namespace.
- TriggerFilter + subscriber.
- ChannelLower-level pipe with Subscription.
2.CRD Cheat Sheet
| Kind | apiVersion | What it is |
|---|---|---|
| Service (ksvc) | serving. | Whole app, Config + Route |
| Configuration | serving. | Pod template, makes Revisions |
| Revision | serving. | Immutable snapshot |
| Route | serving. | URL to Revisions, percent split |
| Broker | eventing. | Event ingress |
| Trigger | eventing. | Filter + subscriber |
| InMemoryChannel | messaging. | Dev-grade channel |
| KnativeServing | operator. | Operator CR for Serving |
| KnativeEventing | operator. | Operator CR for Eventing |
3.Install Steps
Setup Flow
1. CRDs + coreserving-crds, serving-core
2. NetworkingKourier, Contour, Istio, Gateway API
3. DNSMagic DNS (a LoadBalancer IP) or Host header
4. Apply ksvcRevision, Route, Deployment
5. EventsBroker + Trigger
In short : Eventing routes CloudEvents from Sources through a Broker to Triggers that filter and deliver them, and Serving and Eventing install as two independent parts in their own namespaces.
1.kubectl Commands (Knative)
| Command | Description |
|---|---|
| kubectl apply -f serving-crds.yaml | Install Serving CRDs, then serving-core |
| kubectl apply -f serving-default-domain.yaml | Magic DNS via sslip.io (needs a LoadBalancer IP; YAML installs only) |
| kubectl apply -f operator.yaml | Install the Knative Operator |
| kubectl get ksvc -A | List services, URL, ready state |
| kubectl get revisions,routes,configurations | Objects a ksvc created |
| kubectl get pods -n knative-serving | Control plane health |
| kubectl describe ksvc <name> | Conditions show why not Ready |
| curl -H "Host: <url>" http://<INGRESS_IP> | Call a service with no DNS |
| kubectl get brokers,triggers,sources | Inspect eventing objects |
2.Minimal Knative Service
hello.yaml
apiVersion: serving.knative.dev/v1 kind: Service metadata: name: hello spec: template: metadata: annotations: autoscaling.knative.dev/max-scale: "5" spec: containers: - image: "ghcr.io/knative/helloworld-go\ @sha256:05c2c89a7a143b85682a69d9aa\ 9f1d0f2a0ec857ba83bd13b8317f2e5ddb13de"
One Service makes the Configuration, Route and first Revision. Annotations here are copied to every Revision. The image is pinned by digest: helloworld-go has only the tag latest.
3.Gotchas and Fit with Core K8s
Gotchas
- No networking layer: the ksvc still gets a URL, but stays not Ready (IngressNotConfigured).
- Revisions are immutable. Edit the Service, not the Revision.
- Gateway API networking is beta in install docs.
- Native brokers (Kafka, RabbitMQ) beat channel-based ones.
Fits with core K8s
- A ksvc makes a Deployment, a Service and an Ingress-like route.
- Control plane lives in knative-serving and knative-eventing.
- Config is in ConfigMaps like config-autoscaler, config-network, config-domain.
In short : Knative Serving scales HTTP apps from zero to N with Revisions and traffic split, while Eventing routes CloudEvents with Brokers and Triggers.