如何使用 Ocelot API 网关重新路由来支持 Kubernetes readiness/liveness 探测?
How to support the Kubernetes readiness/liveness probe with Ocelot API Gateway re-routes?
我正在尝试使用 Ocelot 作为 K8S 集群的网关,理想情况下我想使用 readiness/liveness 探测器。但是我尝试让 Ocelot 处理探测器端点的每一种方法都会导致问题:
- 如果我不为它创建重新路由,Ocelot returns 404
- 如果我将端点重新路由回自身,Ocelot 会陷入无限循环
- 如果我将端点重新路由到一个没有重新路由的现有位置,Ocelot returns 404
有没有办法让 Ocelot 允许访问驻留在同一服务中的端点?
我知道怎么做了。它实际上非常简单,您只需在管道中比 Ocelot 中间件更早地注入 MVC 中间件,MVC 将在 Ocelot 看到它们之前处理对内部端点的请求。
app.UseMvc();
app.UseOcelot().Wait();
我正在尝试使用 Ocelot 作为 K8S 集群的网关,理想情况下我想使用 readiness/liveness 探测器。但是我尝试让 Ocelot 处理探测器端点的每一种方法都会导致问题:
- 如果我不为它创建重新路由,Ocelot returns 404
- 如果我将端点重新路由回自身,Ocelot 会陷入无限循环
- 如果我将端点重新路由到一个没有重新路由的现有位置,Ocelot returns 404
有没有办法让 Ocelot 允许访问驻留在同一服务中的端点?
我知道怎么做了。它实际上非常简单,您只需在管道中比 Ocelot 中间件更早地注入 MVC 中间件,MVC 将在 Ocelot 看到它们之前处理对内部端点的请求。
app.UseMvc();
app.UseOcelot().Wait();