DEV Community

Cover image for Introducing Knative (and it's components)
Ashok Nagaraj
Ashok Nagaraj

Posted on • Updated on

Introducing Knative (and it's components)

Knative is an open-source extension of Kubernetes that enables serverless workloads to run on Kubernetes clusters(https://knative.dev/). It was originally developed by Google in collaboration with IBM, Pivotal, Red Hat, SAP and nearly 50 other companies and made open source in 2021. As of 2023 it has been donated to CNCF. Knative consists of 3 components - Serving, Eventing and Functions.
Previously Knative build was a component of Knative suite, but has since been forked out into it's own project called Tekton

Knative capabilities

Knative extends kubernetes by adding middleware to allow serverless paradigm with following capabilities:

  1. Scale-down: Pods can scale up and down based on load (including scale-to-zero) => no traffic means no resources => saving on cpu, memory => cost savings
  2. Scale-up: Knative automatically scales up workloads when traffic spikes
  3. Traffic splitting: Blue-green deployments and canary are made possible by knative's traffic splitting capabilities
  4. Building images: Tekton can be used to automatically and intelligently build images enabling CI/CD workflows
  5. Event driven architectures: enabled with Knative eventing
  6. Modernization workflows: Legacy systems flows can be connected to microservices with eventing and addons like Keptn
Knative components
  1. Knative Serving is a component that enables you to deploy, run, and scale serverless applications on Kubernetes. It provides features such as automatic scaling, revision management, traffic routing, network programming, service mesh integration, and observability. You can use Knative Serving to create Knative Services that consist of a configuration and one or more revisions. A revision is an immutable snapshot of your code and configuration at a point in time.

  2. Knative Eventing is a component that enables you to use an event-driven architecture with your applications. It provides APIs to create components that route events from event producers to event consumers, known as sinks. Sinks can also be configured to respond to HTTP requests by sending a response event. You can use Knative Eventing to create event sources that generate events from various sources such as Kafka, GitHub, PingSource, etc. 

  3. Knative Functions is a feature that enables you to easily create, build, and deploy stateless, event-driven functions as Knative Services by using the func CLI or the kn func plugin. You can use different languages such as Go, Node.js, Python, Quarkus, or Spring Boot to write your functions. When you build or run a function, an Open Container Initiative (OCI) format container image is generated automatically for you, and is stored in a container registry. Each time you update your code and then run or deploy it, the container image is also updated.

kn cli

The kn CLI is a command-line tool that provides a quick and easy interface for creating Knative resources, such as Knative Services and Event Sources, without the need to create or modify YAML files directly. The kn CLI also simplifies completion of otherwise complex procedures such as autoscaling, traffic splitting, revision management, event binding, and more.

You can install the kn CLI by using different methods depending on your operating system. For example, you can use Homebrew, binary download, Go installation, or container image. You can also use plugins to extend the functionality of the kn CLI.

The kn CLI does not have its own login mechanism. 
Note: To log in to your cluster, you must install another CLI tool such as oc or kubectl and use their login commands


Reference links

Top comments (2)

Collapse
 
abhishek357 profile image
Abhishek Singh Chauhan

Thanks for the article, really useful :)
Small nit: Link for using brokers and triggers to filter and deliver events based on attributes: developer.ibm.com/tutorials/knativ...
is not working

Collapse
 
ashokan profile image
Ashok Nagaraj

You are right; I could not find the latest working link :(