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.
Service (ksvc) Configuration Route makes Revision v1 Revision v2 10% 90% Deployment K8s Service+ Ingress

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.
Client Networking layerKourier / Istio Activator pods up Pod queue-proxy User container Autoscaler metrics setsreplicas

3.Autoscaling

Default autoscaler is KPA, driven by concurrency or RPS. Scale to zero is on by default.

  • Annotations autoscaling.knative.dev/min-scale and 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.
0 pods request 1 pod load N pods idle, scale to zero
TopicDeployment + HPAKnative Service
Scale to zeroNoYes (default)
Scale signalCPU / memoryConcurrency or RPS
Traffic splitIngress or mesh tricksBuilt in per Revision
RollbackReplicaSets, manualImmutable Revisions
Objects to writeDeployment, Service, Ingress, HPAOne Service
Cold startNoneYes
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.
SourcePingSource Broker Trigger Atype=x Trigger Btype=y App 1 App 2 after retries Dead letter sink

2.CRD Cheat Sheet

KindapiVersionWhat it is
Service (ksvc)serving.knative.dev/v1Whole app, Config + Route
Configurationserving.knative.dev/v1Pod template, makes Revisions
Revisionserving.knative.dev/v1Immutable snapshot
Routeserving.knative.dev/v1URL to Revisions, percent split
Brokereventing.knative.dev/v1Event ingress
Triggereventing.knative.dev/v1Filter + subscriber
InMemoryChannelmessaging.knative.dev/v1Dev-grade channel
KnativeServingoperator.knative.dev/v1beta1Operator CR for Serving
KnativeEventingoperator.knative.dev/v1beta1Operator CR for Eventing
operator.knative.dev serving.knative.dev eventing.knative.dev Service, Revision,Route, Config Broker, Trigger,Sources messaging : channels Your cluster knative-serving activator, ctrl knative-eventing ctrl, broker two namespaces, install either one

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)

CommandDescription
kubectl apply -f serving-crds.yamlInstall Serving CRDs, then serving-core
kubectl apply -f serving-default-domain.yamlMagic DNS via sslip.io (needs a LoadBalancer IP; YAML installs only)
kubectl apply -f operator.yamlInstall the Knative Operator
kubectl get ksvc -AList services, URL, ready state
kubectl get revisions,routes,configurationsObjects a ksvc created
kubectl get pods -n knative-servingControl 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,sourcesInspect 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.