Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags



Educative Answers Team
svg viewer

What is Knative?

Knative is an open-source tool built over Kubernetes to provide middleware components that are essential in bringing together server-less computing, containers, and clusters.

Before Knative, while working with Kubernetes, developers had to worry about pods, deployment, scalability, and other Kubernetes objects. This problem was solved by bringing FaaS-like capabilities to Kubernetes with the introduction of Knative. Now, developers do not need to get tangled up in .yaml files and can simply work on deploying their containers as Knative takes care of the rest.

Knative Architecture

svg viewer

Kubernetes provides the necessary infrastructure and resources for Knative. Knative uses Custom Resource Definitions (CRDs) to abstract the underlying resources provided by Kubernetes so that developers can focus on creating an application without delving into complicated .yaml files.

There is a dedicated Service Mesh layer built on top of *Kubernetes that allows different parts of an application to reliably communicate with each other. Although other Service Mesh can be used, Istio is generally preferred.

The Service Mesh layer sits below the Knative layer, which has two main components:

  • Knative Serving
  • Knative Eventing

Knative Serving

Knative Serving takes help from the Kubernetes and Istio resources to build a serverless environment. It makes use of CRDs to monitor how the workload behaves. Knative serving is made up of four components:


1. Serving

Serving makes the life of a developer easier by taking care of all the workload of the application throughout its lifecycle. It takes care of route, configuration, ensures that there is a new revision for each update, and routes traffic to active/recent/pinned revision.

2. Routing

Routing helps you manage the traffic routed to the micro-services of the application. The developer is in control of routing the traffic selectively. If there are multiple revisions, say R1, R2, and R3, the developer can effectively route a different percentage of network traffic to each revision.

svg viewer

3. Configuration

Configuration takes care of settings and variables outside the actual code. It makes use of the Twelve-Factor App MethodologyA methodology developed by developers at Heroku to help programmers synthesize best programming practices in their code when developing cloud applications.. When a configuration is tweaked, a new revision created for it.

4. Revision

Revision is a point-in-time snapshot of the code and configuration whenever the developer makes a change. These revisions do not change over time and can be used to load-balance the network traffic.

Revisions can automatically scale to zero if need be. The Revision will temporarily become inactive when there is no incoming network traffic. As soon as it gets a request, the Revision will be scaled up; however, there will only be a slightly increased latency when requesting from a scaled-to-zero Revision. This is referred to as a cold-start.

Knative Eventing

Knative Eventing is a model designed to help developers make applications natively by providing necessary primitive tools for communication between event-sources and event-consumers.


Event Consumers

Knative makes use of Addressable and Callable objects to enable delivery to multiple services. Whenever an event is received through HTTP, Addressable objects recognize and then acknowledge it. Callable objects go one step further and return either 0 or 1 events in an HTTP response.

Event Brokers and Triggers

Broker, as the name suggests, is the intermediary that connects the requests with the appropriate service.

Triggers essentially determines which event is forwarded to which service. It also makes filters on event attributes to route them to their Addressable.

Broker makes use of Triggers to decide which service to route the event to.

Event Registry

Event Registry is a list of events a consumer can request from a broker. An EventType object is available for consumers that contain this list.

To learn more about Knative, visit the official documentation.


Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring