Knative (original) (raw)
What is Knative?
Knative is an Open Source project based on the Kubernetes platform for building, deploying and managing serverless workloads that can run in the cloud, on premises or in a third-party data center. It was originally started by Google with contributions from more than 50 companies, including industry giants such as IBM, Pivotal, Red Hat and SAP.
The Knative framework relies on Istio -- an open source service mesh developed by Google -- to manage traffic routing, revisions and metrics. Knative's integration with Istio makes it easier for containerized and serverless workloads to be exposed on the internet, monitored and controlled. This integration also ensures developers' data is encrypted during transit.
Knative aggregates all the best practices of other Kubernetes-based frameworks into a single framework. Knative, which works like a Kubernetes extension, covers any type of modern serverless workload. It combines all these workloads under a common topology and terminology set.
Developers on Knative can use any language, idioms and frameworks they choose to deploy functions, applications and container workloads.
What is Knative used for?
Knative provides several open source tools that integrate natively with Kubernetes. Using the open source framework, developers can build and deploy container-based serverless applications and move those apps between cloud providers. Knative enables companies to deploy serverless functions on internal Kubernetes clusters.
Developers on the server side who are focused on cloud-native development and use Kubernetes as their base container platform can use Knative. Knative can also help developers who are having issues configuring Kubernetes to manage container-based environments as well as those adopting a microservices-based approach using containers.
Knative assists developers by automating the process of building containers. It enables developers to focus on writing code without having to worry about building, deploying and managing their apps. Developers can use Knative as part of a pipeline automation project to enable DevOps teams to get up and running.
The framework also enables easier customer rollouts. Knative lets developers expose new container revisions to a small group of users first, gradually increasing the number of users. If there are any problems, developers can quickly roll back to older versions.
Knative features
Knative offers features such as autoscaling, in-cluster builds, scale-to-zero and eventing framework for cloud-native apps on Kubernetes.
It includes two main components that enable developers to deploy and manage their serverless apps in their Kubernetes clusters.
- Serving. The Serving primitive helps developers deploy serverless apps as Knative services and scale them automatically, even down to zero instances. Knative uses Istio to expose developers' serverless and containerized workloads. When developers install the managed Knative add-on, the managed Istio add-on is also automatically installed. Developers can use Istio's intelligent routing and traffic management functionality to control what traffic is routed to specific versions of their services. Developers can then more easily test and roll out new app versions or perform A/B testing.
- Eventing. The Eventing primitive helps developers build event-driven applications. For example, maybe a developer wants to launch a new build of an app every time code is pushed to the GitHub main repository. Or maybe a developer only wants to run a serverless application if the temperature drops to 32 degrees Fahrenheit or lower. Developers can integrate the Eventing primitive into their continuous integration/continuous delivery (CI/CD) pipelines to automate the build and deployment of their apps in case a specific event occurs.
The Knative open source project deprecated the Build primitive and replaced it with the Tekton open source project. The Build primitive provided a developer with the tools to automate the build process for an app from source code to a container image.
The Tekton project, which stems from the Knative project, offers advanced CI/CD features on top of the deprecated Knative Build primitive. Tekton is a flexible Kubernetes-native open source framework used to create CI/CD systems. Tekton offers open source components to enable developers to standardize their CI/CD tooling and processes across languages, vendors and deployment environments.
Knative vs. Kubeless
Kubeless is a Kubernetes-native serverless framework that enables developers to deploy small pieces of code without having to be concerned about the underlying infrastructure. It's deployed on top of a Kubernetes cluster and uses Kubernetes resources to provide application programming interface routing, autoscaling, monitoring and troubleshooting.
The Kubeless framework supports Hypertext Transfer Protocol (HTTP) and event-based function triggers. It has a serverless plugin, a graphical user interface and multiple runtimes, including Python and Node.js.
It accepts commands to register, delete and list functions that a developer would like to run. Kubeless makes it easier for developers to set up containers and pods.
Kubeless creates functions such as custom Kubernetes resources using a custom resource definition. Kubeless then runs an in-cluster controller that watches these custom resources. The controller launches runtimes on demand and dynamically injects the code of the functions into the runtimes so that they're available over HTTP or via the publish/subscribe messaging mechanism. Any message published to a topic in a publish/subscribe model is immediately received by every subscriber to the topic.
Knative is adopted faster than Kubeless and has a greater chance of being accepted among developers than Kubeless. Not just because of the timing of its release -- it was released during a time of increased serverless adoption -- but also because it uses Kubernetes and Istio, popular open source components already widely deployed in containerized environments.
Both Kubeless and Knative offer building blocks that make it easier for developers to use Kubernetes and Istio to manage and operate lambda functions such as small anonymous functions.
Kubeless builds an image out of code and starts it on Kubernetes. Knative does the same, but uses a more modular approach, enabling different components to plug into and adapt to different deployment scenarios. Knative and Kubeless are both categorized as serverless and task processing tools.
Knative vs. Lambda
AWS Lambda is a compute service that runs developers' code in response to events and automatically manages the underlying compute resources. Developers can use AWS Lambda to extend other AWS services with custom logic. Alternatively, developers can create their own back-end services that operate at AWS scale, performance and security.
While Lambda is a hosted and packaged tool, Knative is a set of software building blocks. As such, Knative differs from Lambda in several ways. For example, developers can run it locally or install it onto a Kubernetes cluster anywhere, including on AWS or Google Cloud.
In addition, Knative also offers portability, meaning developers aren't locked into one cloud provider. Although there are plugins to allow for features that are specific to certain vendors, the main experience and runtime behavior are the same for each cloud.
This was last updated in June 2023
Continue Reading About Knative
- An overview of Knative use cases, benefits and challenges
- CNCF now incubating Knative for serverless and event-driven apps
- IT teams face an uphill battle with serverless migrations