配置 istio 目标规则以使用回退 URL 而不是 503

Configure istio destination rule to use a fallback URL instead of 503

我知道您可以在服务无响应时使用 istio 打开断路器。不是 return 返回 503,是否可以重定向到不同的 URL?同样的问题,但是当原始服务 return 返回 500 时,我们可以重定向到另一个 URL 吗?

或者是否可以使用 istio 提供的离线模式响应?我认为最简单的方法是通过 URL 重定向到 离线模式服务 URL,但对想法持开放态度...

can we redirect to another URL?

如果我没理解错的话,你是在问是否可以只用 istio 做到这一点。


根据documentation

While Istio failure recovery features improve the reliability and availability of services in the mesh, applications must handle the failure or errors and take appropriate fallback actions. For example, when all instances in a load balancing pool have failed, Envoy returns an HTTP 503 code. The application must implement any fallback logic needed to handle the HTTP 503 error code.

dzone.com, Christian Posta blog post

Istio improves the reliability and availability of services in the mesh. However, applications need to handle the errors and take appropriate fallback actions. For example, when all instances in a load balancing pool have failed, Envoy will return HTTP 503. It is the responsibility of the application to implement any fallback logic that is needed to handle the HTTP 503 error code from an upstream service.

With a service mesh, at the moment without specialized libraries for failure context propagation, the failure reasons are more opaque. This doesn’t mean our application cannot take fallbacks (for both transport and client-specific errors). I’d argue it’s very important for the protocol of any application, whether using library-specific frameworks OR NOT) to always adhere to the promises it’s trying to keep for its clients. If it finds that it cannot complete its intended action, it should figure a way to gracefully degrade. Luckily, you don’t need application-specific frameworks for this. Most languages have built-in error and exception trapping and handling. Fallbacks should be implemented in these exception paths.


很遗憾,答案是,你不能。您必须在您的应用程序中实现它。


其他资源: