October 25, 2025

Kubernetes - Knative

Knative

Knative is an open source platform that runs on Kubernetes and makes it simple to build, deploy, and operate serverless style workloads. You package your code as a container, apply a very small manifest, and Knative takes over routine tasks such as rapid scale up, scale to zero when idle, routing traffic to the right version, and wiring events. The goal is to let teams focus on code and contracts while the platform handles elasticity and networking.

Key capabilities

Serving. Knative Serving runs container images behind stable URLs and autoscaling based on incoming requests. It supports scale to zero for idle services, fast cold starts, and traffic splitting for blue-green and canary rollouts. Each update creates an immutable “Revision,” so you can promote or roll back with precision.

Eventing. Knative Eventing lets producers and consumers exchange events without tight coupling. It provides Brokers and Triggers for pub-sub style routing, Sources for common systems, and uses CloudEvents so messages have a consistent shape across tools.

Traffic and networking. Knative works with several Kubernetes gateways such as Kourier, Istio, Contour, or Gateway API. It gives you HTTP routing, TLS, custom domains, and per-revision traffic percentages without you writing ingress rules by hand.

Developer and operator experience. You declare the image and a few settings, Knative reconciles the rest. Operators get multi-tenant isolation, policy control, and pluggable autoscalers that consider concurrency and request latency.

serving.knative.dev/v1.Service vs apps/v1.Deployment

At heart, serving.knative.dev/v1 Service is a Custom Resource that represents an application endpoint with desired runtime and traffic behavior. When you create one, Knative’s controllers generate and manage lower level objects on your behalf: a Configuration, a Route, and immutable Revisions, plus the Deployments, ReplicaSets, Services, and Ingress resources needed to run them. In contrast, apps/v1 Deployment is a native Kubernetes resource that manages Pods via ReplicaSets. A Deployment keeps the requested number of Pods running, but it does not natively provide request based autoscaling to zero, traffic splitting across versions, or automatic URL management.

So Knative is not “more advanced Kubernetes” baked into the core. It is an add-on that extends Kubernetes through CRDs and controllers. It stands on Kubernetes primitives and adds higher level behavior for request driven workloads.

Minimal side by side example:

Knative Service

apiVersion: serving.knative.dev/v1 kind: Service metadata: name: hello spec: template: spec: containers: - image: gcr.io/acme/hello:1.0

Kubernetes Deployment plus Service

apiVersion: apps/v1 kind: Deployment metadata: name: hello spec: replicas: 3 selector: matchLabels: app: hello template: metadata: labels: app: hello spec: containers: - name: hello image: gcr.io/acme/hello:1.0 --- apiVersion: v1 kind: Service metadata: name: hello spec: selector: app: hello ports: - port: 80 targetPort: 8080

In the first file you declare intent, and Knative creates revisions, routes traffic, and scales based on demand, even to zero when idle. In the second, you wire replicas and networking yourself, then add and operate tools for autoscaling, rollout strategies, and ingress.

Installation

Installation is not “import a Go library.” Knative is installed onto a Kubernetes cluster. The project supports three paths. For a local trial, use the Knative quickstart: install the kn CLI and its quickstart plugin, then run a single command such as kn quickstart kind or kn quickstart minikube; this stands up a cluster with Serving and Eventing preconfigured. For production, apply the official YAML for Serving and Eventing with kubectl, meeting the documented Kubernetes and hardware prerequisites. Alternatively, install the Knative Operator on your cluster and create the KnativeServing and KnativeEventing custom resources so the operator manages install, config, and upgrades. Note that the kn CLI helps you create and manage Knative resources, but it does not itself install the core components.

Summary

Knative brings serverless ergonomics to Kubernetes. It gives you simple manifests for request oriented apps, fast and safe rollouts through immutable revisions and traffic splitting, event driven integration through a consistent event model, and autoscaling that responds to real traffic. Use a Knative Service when you want a higher level, request aware platform to run containers. Use a plain Deployment when you need full manual control over Pods and traffic or when your workload does not benefit from request based scaling and routing.

No comments:

Post a Comment