Knative Official Documentation
Knative provides Kubernetes-based building blocks that matter most to developers. Built on Kubernetes APIs, Knative streamlines serverless application development and delivery.
What is Knative?
Knative is a Kubernetes-based framework for building, deploying, and managing modern serverless workloads. It provides standardized, platform-agnostic components that enable developers to focus on business logic rather than infrastructure complexity.
Knative requires a Kubernetes cluster (v1.24+ recommended) and integrates with any CNI plugin, container registry, and message broker that supports Kubernetes standards.
Core Components
Knative is composed of three primary modules, each solving a critical cloud-native challenge:
| Component | Purpose | Key Features |
|---|---|---|
| Knative Serving | Deploy & scale serverless containers | Zero-to-one scaling, revision management, traffic splitting, concurrency limits |
| Knative Eventing | Event-driven architecture | Channels, brokers, triggers, subscriptions, CLoudevents compliance |
| Knative Build | Source-to-image compilation | Configurable builds, multi-step pipelines, artifact integration |
Architecture Overview
Knative extends Kubernetes through Custom Resource Definitions (CRDs) and controllers that reconcile desired state. The architecture follows a control-plane/data-plane separation:
- Control Plane: Controllers watch for
Service,Revision, andConfigurationresources, generating underlying Deployments, Services, and Routes. - Data Plane: The
net-istioornet-kourieringress controllers handle traffic routing, TLS termination, and request distribution. - Autoscaler: The
autoscaler-hpaorkpa(Knative Pod Autoscaler) monitors request concurrency and CPU/memory metrics to scale pods.
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
env:
- name: TARGET
value: "World"
containerConcurrency: 10
Installation
Knative can be installed via kn CLI, ko, or kubectl apply. The recommended production approach uses the official YAML manifests or Helm charts.
kubectl apply --filename https://github.com/knative/serving/releases/download/knative-v1.12.0/serving-crds.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/knative-v1.12.0/serving-core.yaml
kubectl apply --filename https://github.com/knative/net-istio/releases/download/knative-v1.12.0/istio.yaml
Always review resource requests/limits and enable PodDisruptionBudgets before deploying to production clusters. Default configurations are optimized for development.
Knative Serving Deep Dive
Knative Serving abstracts Kubernetes Deployments behind the Service API. Each Service creates a Configuration, which spawns Revisions. Traffic is routed through a Route and Configuration object.
Revision Strategy
Revisions are immutable snapshots of your application. This enables safe rollouts, canary deployments, and instant rollbacks without downtime.
- Active Revision: Currently receiving traffic
- Latest Revision: Most recently created, not necessarily receiving traffic
- Ready Revision: Passes health checks and is eligible for routing
Eventing Fundamentals
Knative Eventing provides a cloud-native, declarative eventing platform. It adheres to the CloudEvents specification and enables loose coupling between producers and consumers.
Broker & Trigger Model
The Broker/Trigger model is the recommended pattern for production workloads. Brokers aggregate events from multiple sources, while Triggers filter and route events to specific subscribers.
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
name: default
---
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: order-processor
spec:
broker: default
filter:
attributes:
type: dev.knative.source.order.created
subscriber:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: order-service