Knative is an open-source platform that adds serverless capabilities to Kubernetes, letting teams run containers that scale automatically with traffic, scale to zero when idle and react to events. In serverless computing, it fills the gap between fully managed function services and raw Kubernetes: developers deploy a container image, and Knative handles routing, revisions and autoscaling on a cluster the organization controls.
Knative originated at Google in 2018, was developed with contributors from IBM, Red Hat, VMware and others, and became a Cloud Native Computing Foundation project. Its serving API also inspired Google Cloud Run, which exposes a largely compatible resource model as a managed service.
How Knative works on top of Kubernetes
Knative works by installing custom resource definitions and controllers into a Kubernetes cluster. Developers create high-level Knative objects, and the controllers translate them into ordinary Deployments, Services and Pods, plus routing rules in a pluggable networking layer such as Kourier, Istio or Contour.
The platform consists of two main components. Knative Serving runs request-driven HTTP workloads, while Knative Eventing delivers events between producers and consumers using the CloudEvents specification. Each component can be installed independently, and the table below lists the core resources.
| Resource | Component | Purpose |
|---|---|---|
| Service | Serving | Top-level object that manages a workload’s configuration and routes |
| Configuration | Serving | Desired state of the code and settings; each change creates a revision |
| Revision | Serving | Immutable snapshot of code and configuration at one point in time |
| Route | Serving | Maps a network endpoint to one or more revisions with traffic percentages |
| Broker and Trigger | Eventing | Event hub plus filters that forward matching events to subscribers |
| Source | Eventing | Adapter that imports events from an external system |
Because every configuration change produces a new immutable revision, Knative supports traffic splitting natively. A route can send 90 percent of requests to the current revision and 10 percent to a new one, which makes canary and blue-green releases a matter of editing one field.
Autoscaling and scale to zero in Knative
Knative scales workloads with the Knative Pod Autoscaler (KPA), which reacts to concurrent requests or requests per second rather than CPU usage. A small queue-proxy sidecar in each pod reports metrics, and the autoscaler adjusts the replica count within seconds.
When traffic stops for a configurable grace period, the KPA reduces the revision to zero replicas. A component called the activator then receives new requests, buffers them, signals the autoscaler and forwards traffic once a pod is ready. This mechanism saves resources but introduces a cold start, whose length depends on image size, runtime and application initialization.
| Setting | Typical value | Effect |
|---|---|---|
| Container concurrency target | About 100 by default | Requests per pod before more pods are added |
| Min scale | 0 or 1 and higher | Zero enables scale to zero; one or more avoids cold starts |
| Max scale | Workload-dependent limit | Caps cost and protects downstream systems |
| Stable window | About 60 seconds | Period over which average load is calculated |
| Scale-to-zero grace period | About 30 seconds | Delay before the last pod is removed |
Teams can switch to the standard Horizontal Pod Autoscaler for CPU-bound workloads, but then lose scale to zero. Setting a minimum scale of one is the usual compromise for latency-sensitive services.
Knative compared with other serverless options
Knative differs from managed serverless services mainly in who operates the platform and how portable the workload remains. It runs the same way on any conformant Kubernetes cluster, in a public cloud or on premises, whereas managed offerings tie the workload to one provider.
| Platform | Unit of deployment | Operated by | Portability |
|---|---|---|---|
| Knative | Container image | The cluster owner | Any conformant Kubernetes cluster |
| Google Cloud Run | Container image | Knative-compatible service model | |
| AWS Lambda | Function package or image | AWS | Provider-specific runtime and triggers |
| OpenFaaS | Function in a container | The cluster owner | Kubernetes or a lightweight host |
| AWS Fargate | Container task | AWS | No scale to zero by request |
Compared with function as a service products, Knative imposes fewer runtime constraints: any language, any HTTP server and long-lived connections such as WebSockets or gRPC streams work. The price is operational responsibility for the cluster, the networking layer and upgrades.
When to use Knative and how to configure it
Knative is a strong choice when an organization already runs Kubernetes and wants serverless behavior for many small services, internal APIs or event processors without adopting a provider-specific function platform. It is also common in hybrid and on-premises environments where managed serverless is not available.
- Keep container images small and startup code lean to shorten cold starts.
- Set min scale to one for user-facing endpoints with strict latency targets.
- Tune the concurrency target to the real capacity of one pod, measured under load.
- Use tagged revisions to test a new version on a private URL before shifting traffic.
- Prefer a lightweight ingress such as Kourier unless a service mesh is already required.
For event-driven designs, a Broker with filtered Triggers decouples producers from consumers, while Channels and Subscriptions suit simple fan-out pipelines. Production brokers usually rely on a durable backend such as Apache Kafka rather than the in-memory default.
Limitations and common mistakes with Knative
Knative does not remove infrastructure work; it moves serverless operations onto the team that runs the cluster. The control plane, networking layer and eventing backends add components to monitor and upgrade, and idle nodes still cost money unless the cluster autoscaler also shrinks the node pool.
| Problem | Likely cause | Fix |
|---|---|---|
| Slow first request | Revision scaled to zero with a large image | Reduce image size or set min scale to one |
| Overloaded database | No max scale limit on a busy service | Set max scale and connection pooling |
| Lost events | In-memory channel used in production | Use a durable Kafka-backed broker |
| No savings at night | Nodes stay running after pods scale down | Enable cluster node autoscaling |
A frequent misconception is that Knative is a function framework. It runs containers, not functions; the separate Knative Functions tooling only helps build such containers from source code.
In simple terms
Knative is an add-on that makes a Kubernetes cluster behave like a pay-as-you-go service. A team hands it a packaged application, and Knative gives it a web address, starts copies when visitors arrive and switches everything off when nobody is using it.
Think of an office building where the lights in each room turn on when someone walks in and turn off after everyone leaves. The building is still there and still needs maintenance, but energy is spent only where people are working. Knative does the same for software running on the organization’s own computers.
A practical example
A regional bank runs a private Kubernetes platform in its own data centers because regulations limit the use of public serverless services for customer data. Its developers maintain about 120 small internal services, such as document converters and report generators, many of which receive only a few requests per hour.
The platform team installs Knative Serving with Kourier and migrates these services from always-on Deployments. Rarely used services scale to zero, while the loan-quote API keeps a minimum of two pods to meet a 300-millisecond response target. New releases go out as revisions with 10 percent canary traffic for one hour before full rollout.
After three months, the number of continuously running pods falls by roughly 60 percent, freeing enough capacity to postpone a planned hardware purchase, and failed releases are rolled back by reassigning traffic in seconds rather than redeploying.