The garden is full of spring and can't be closed, let you experience Alibaba Cloud Knative



Author | Yuan Yi

Guide: Knative is an open source serverless application orchestration framework based on Kubernetes. Based on the community Knative, Alibaba Cloud Knative is deeply integrated with Alibaba Cloud products to bring you the purest containerized serverless experience.

About Knative

Knative is an open source serverless application orchestration framework based on Kubernetes. In fact, Knative includes not only Workload, but also Kubernetes' native process orchestration engine and complete event system. Knative's goal is to provide application serverless workload orchestration standardization based on Kubernetes. Knative core modules mainly include event-driven framework Eventing and Serving to deploy workloads.

1. Serverless Service Engine-Serving

The core capability of Knative Serving is its concise and efficient application hosting service, which is also the foundation of its serverless capability. Of course, as a Serverless Framework, it is inseparable from the ability to allocate resources on demand. Knative can automatically expand the number of instances during peak periods according to the request volume of the application. When the request volume is reduced, the number of instances will be automatically scaled down, which can help you save costs very automatically.

Serving also provides traffic management capabilities and flexible gray release capabilities. The traffic management capability can divide the traffic according to the percentage, and the gray release capability can be grayed according to the traffic percentage.

1) Simple application model

Provides a minimalist application model-Knative Service, which also satisfies the capabilities of service deployment, service access, and grayscale release. It can be expressed by the following formula: Knative Service = Workload (Deployment) + Service Access (Service) + Grayscale Traffic (Ingress).

The application model is as shown below


  • Service: An abstraction of the Serverless application model, which manages the life cycle of the application through Service;
  • Configuration: Used to configure the information expected by the application. Each time the Service is updated, the Configuration will be updated;
  • Revision: Each update of Configuration will create a snapshot for version management;
  • Route: Route requests to Revision, and can forward different proportions of traffic to different Revisions.

  • Application hosting

    • Kubernetes is an abstraction for IaaS management. Directly deploying applications through Kubernetes requires more resources to maintain;
    • A resource can define application hosting through Knative Service.
  • Traffic management

    • Knative applies traffic through the Gateway results, and then can divide the traffic by percentages, which lays the foundation for basic capabilities such as elasticity and grayscale.

  • Grayscale release

    • Support multi-version management, it is easy to realize that the application has multiple versions to provide services online at the same time;
    • Different versions can set different percentages of traffic, and it is easy to implement functions such as grayscale release.

  • elasticity

    • The core ability of Knative to help applications save costs is flexibility, which automatically expands when the traffic increases, and automatically shrinks when the traffic drops;
    • Each gray version has its own elastic strategy, and the elastic strategy is related to the traffic flow allocated to the current version. Knative will make the decision to expand or shrink the capacity based on the amount of traffic allocated.

2) Rich flexibility strategy

As a serverless framework, its core capability is automatic elasticity. Knative provides a wealth of elastic strategies:

  • Automatic expansion and contraction based on traffic request-KPA
  • Automatic expansion and contraction based on CPU and Memory-HPA
  • Support timing + HPA auto-scaling strategy
  • Event gateway, providing one-to-one processing capability between request and Pod

2. Serverless Event Driven Framework-Eventing

Event-driven is the standard configuration of Serverless, and Knative also provides an event-driven framework-Eventing.

Knative's Eventing provides a complete event model, which can easily access events from various external systems. After the event is accessed, it will be transferred internally through the CloudEvent standard.

Knative Eventing provides two event forwarding methods:

  • The event source is directly forwarded to the service;
  • The event source is forwarded to Broker / Trigger, and then forwarded to the service through filtering.


Which method should be used for forwarding during use? In fact, it is very simple. The Broker / Trigger model is implemented based on the underlying message system. For event sources like Github, Gitlab, and K8s APIserver, message events need to be buffered to ensure the reliability of message transmission, then we recommend using events The source is forwarded to Broker / Trigger for event flow.

For the event source itself is the message system, such as MNS, Kafka, RocketMQ, it is more efficient to use the event source to forward directly to the service.

Speaking of this, I have to mention Knative's event source. I liken it to an event-driven engine. Knative Eventing drives the flow of events through these event sources.

The Knative community provides a wealth of event sources, such as Kafka, GitHub, etc. In addition, it also accesses event sources of message cloud products, such as MNS, RocketMQ, etc.

Alibaba Cloud Knative

Alibaba Cloud Knative is integrated with Alibaba Cloud's resource system on top of the community's native Knative, providing richer capabilities and cloud product-level support.


1. Integration with Alibaba Cloud products

  • Rich message cloud product event sources: Kafka, MNS, RocketMQ
  • Service access: SLB
  • Storage: NAS, cloud disk, etc.
  • Observability: log service, ARMS
  • IaaS resources: ECS, ECI

2. Natural integration of Alibaba Cloud K8s ecology

  • Support Alibaba Cloud standard version of Kubernetes, proprietary version of Kubernetes;
  • Supports Alibaba Cloud Serverless Kubernetes (ASK), and fully manages Knative control components in ASK, which saves users resources and operation and maintenance costs.

one example

Next, let's take an example of sending barrage to introduce how to play Alibaba Cloud Knative. First look at the effect:


Architecture diagram:


Flow Description:

  • The user sends the bullet screen to Alibaba Cloud Kafka through the bullet screen web service;
  • Kafka Source event source listens to the barrage message, and then sends it to the barrage message processing service;
  • The bullet screen message processing service receives the message, and then automatically expands the instance for message processing, and sends the processed message to the bullet screen service;
  • Finally, the barrage is displayed to the user through the web service interface;

to sum up

Finally, let's summarize what capabilities Alibaba Cloud Knative can bring to us:

  • Low barriers to service deployment, easy to use
  • Serverless uses resources on demand
  • Event-driven seamless connection with message cloud products
  • Naturally integrated Alibaba Cloud K8s ecology
  • Connect with Alibaba Cloud products

I hope that these capabilities can bring you true on-demand use and reduce the cost of operation and maintenance and resource use. This is also the goal pursued by the serverless concept.

阅读 548

819 声望
184 粉丝
0 条评论

819 声望
184 粉丝