Knative Serving 的 Activator 如何拦截缩小修订版本的请求?

dip*_*ark 3 kubernetes istio envoyproxy knative-serving knative

如上所述这里,Knative的激活接收和缓冲的要求不活跃修订。

这个路由是如何实现的?我在应用程序的命名空间中看到的只是一个 VirtualService 路由对修订版的请求,所以我看不到进入网格的流量是如何重定向到 Activator 的。

Knative 服务版本:0.9.0

Rin*_*nor 11

Knative has a new concept (CRD) known as the Serverless service which is created for each Knative Service.

The serverless service creates two Kubernetes Services:

  • The Private service which targets your application pods. It is needed to discover the Pod IPs.
  • The Public service is being targeted by the ingress gateway and according to the Mode it is in (more about it later) it will either point to the same endpoints as the first service or to the endpoints of the activator service.

Serverless Service Modes

Serverless Services can be in one of the following modes:

  • Serve
  • Proxy

Serve Mode

The serverless service is in Serve mode as long as there are pod instances of your application running. As such your Public service is configured with the endpoints from your private service, meaning that requests forwarded by the ingress gateway reach your application as shown in the diagram below:

Knative 无服务器控制器的服务模式

  • hello-go-pb - is the public service.
  • hello-go-pr - is the private service.

Proxy Mode

When the instances of your application are scaled down by the autoscaler, the serverless service controller updates the public service to be configured with the IPs discovered by the Activator Service. Which triggers autoscaling buffers the request until one service is up and running and forwards the request. Proxy mode can be seen in the diagram below:

Knative 无服务器控制器的代理模式

As a summary, the Serverless controller sets the endpoints of the public service by alternating between the endpoints of the Private Service or if it's scaled down to zero to the endpoints of the Activator Service.