×
Community Blog Introduction to Alibaba Cloud Knative

Introduction to Alibaba Cloud Knative

This article introduces Alibaba Cloud Knative and its benefits.

By Yuanyi

Knative is a Kubernetes-based, open-source Serverless application orchestration framework. Knative on Alibaba Cloud is deeply integrated with Alibaba Cloud products based on the Knative for the community to provide the purest experience of containerized Serverless.

Contents

1.  About Knative

  • Serverless Service Engine – Serving
  • Serverless Event-Driven Framework – Eventing

2.  Knative on Alibaba Cloud

  • Integration with Alibaba Cloud Products
  • Native Integration with Alibaba Cloud Kubernetes Ecosystem

3.  Example

About Knative

Knative is a Kubernetes-based open-source Serverless application orchestration framework. Knative includes workloads, Kubernetes-native orchestration engines, and complete event systems and aims to standardize Serverless workload orchestration using Kubernetes. Core Knative modules include Eventing, an event-driven framework, and Serving for deploying workloads.

Serverless Service Engine – Serving

The core capability of Knative Serving is its simple and efficient application hosting service, which is also the foundation for its support for Serverless. As a Serverless framework, Knative can allocate resources based on demand. It scales out instances automatically when applications have a large number of requests and scales in instances when the request volume falls, thus reducing costs. In addition, Serving provides support for traffic management and flexible canary release. The traffic management can split traffic according to the traffic percentage, while the canary release can perform gray release according to the traffic percentage.

Simple Application Model

Knative Service, a simple application model, has been provided. It meets the requirements of service deployment, service access, and canary release. It can be expressed with the following formula: Knative Service = workload (deployment) + service access (service) + traffic in canary release (ingress). The following figure shows the application model:

1

  • Service: Abstracts the Serverless application model and manages the application lifecycle through service
  • Configuration: Configures the information that the application expects. The configuration will be updated every time service is updated.
  • Revision: Creates a snapshot for version control upon configuration updates
  • Route: Routes requests to revision and forwards a different percentage of traffic to different revisions

1.  Application Hosting

  • Kubernetes is an abstraction for IaaS management. More resources are required to maintain application deployment directly via Kubernetes.
  • Resource in Knative Service can define application hosting.

2.  Traffic Management

  • Knative manages application traffic through the gateway. Then, it segments the traffic by percentage, which sets the stage for basic capabilities, such as auto scaling and canary release.

3.  Canary Release

  • Multi-version management of an application is supported, which achieves simultaneous online services of multiple versions easily.
  • Different versions can set different traffic percentages, which can be implemented easily for functions, such as canary release.

4.  Auto Scaling

  • Auto scaling with the traffic fluctuation is the core capability for Knative to reduce costs.
  • Each application version in the canary release has a dedicated auto scaling policy that determines how much traffic is allocated to this version. Knative scales an application based on the amount of allocated traffic.

Abundant Elasticity Policies

As a Serverless framework, Knative has a core capability of auto scaling. It provides multiple elasticity policies:

  • Auto scaling based on traffic requests – Knative Pod Autoscaler (KPA)
  • Auto scaling based on CPU and Memory – Horizontal Pod Autoscaler (HPA)
  • Scheduled and HPA-based auto scaling
  • Event Gateway, which provides one-to-one processing capabilities for requests and pods

Serverless Event-Driven Framework – Eventing

The Event-driven feature is the standard for Serverless, while Knative also provides an event-driven framework called Eventing.

Eventing in Knative provides a complete event model, which can access events in various external systems easily. After accessing, events are forwarded internally through the CloudEvent standard.

Two event forwarding models are available in Knative Eventing:

  • Events are forwarded from the source to the service directly.
  • Events are forwarded from the source to Broker and Trigger and then to the service after filtering.

2

Which method should be used to forward events? The Broker/Trigger model is implemented based on the underlying message system. For event sources, such as GitHub, GitLab, and Kubernetes API server, message events need to be buffered to ensure reliable message transmission. So, we recommend forwarding the messages to Broker and Trigger from event sources.

For event sources that were originally message systems, such as Message Service (MNS), Kafka, and RocketMQ, it is more efficient to forward events to services directly.

At this point, it is necessary to mention Knative's event sources, which are similar to the event-driven engine. Knative Eventing supports the procedure of event processing based on these event sources.

The Knative community provides various event sources, such as Kafka and GitHub. Moreover, event sources of cloud products for message delivery have been accessed as well, such as MNS and RocketMQ.

Knative on Alibaba Cloud

Knative on Alibaba Cloud is based on Knative for the community. It is fully integrated with the Alibaba Cloud resource system and provides richer capabilities and support for cloud products.

3

Integration with Alibaba Cloud Products

Native Integration with Alibaba Cloud Kubernetes Ecosystem

  • Supports standard Kubernetes and proprietary Kubernetes of Alibaba Cloud
  • Supports Alibaba Cloud Serverless Kubernetes (ASK) and fully manages Knative control components in ASK, saving resources and O&M costs

Example

Here's an example of how to use Knative on Alibaba Cloud. It is about sending bullet-screen comments. The effect is shown below:

4

Architecture Diagram

5

Process

  • A user sends comments to Alibaba Cloud Kafka through the web service
  • The Kafka Source monitors comments from the event source and sends the comments to the comment processing service.
  • The processing service receives the comments, scales the instance to process comments automatically, and sends the processed comments to the bullet-screen comments service.
  • Finally, the bullet-screen comments are displayed to users through the web service interface.

Summary

Some capabilities brought by Knative on Alibaba Cloud are listed below:

  • Easy service deployment
  • Serverless-based, on-demand resource usage
  • Seamless integration of Eventing with Alibaba Cloud products for message delivery
  • Native integration with Alibaba Cloud Kubernetes ecosystem
  • Integration with Alibaba Cloud's products

Hopefully, these capabilities can bring real on-demand use experience to users and reduce the cost of O&M and resource use, which is also the goal pursued by Serverless.

0 0 0
Share on

Alibaba Container Service

166 posts | 30 followers

You may also like

Comments

Alibaba Container Service

166 posts | 30 followers

Related Products