I have configured instance group and ALB which directs to these groups. sometimes it happens that none of the IG vms responds and the information "no healthy upstreams" is displayed on the front. I know I can force IG to always run one instance, but that's not what I want.
How can I redirect traffic, e.g. to a custom website with information that the website is in maintenance mode?
I was looking for an option in ALB to redirect traffic, e.g. to a bucket, but I don't see an option to do it when the IG backend is not responding.
As per official GCP doc on Routing and traffic management:
Looks there is no way to control a load balancer's redirect manually based on the backend responses. It's not the purpose of a load balancer in GCP.
This is a known Feature Request which is already faced by multiple customers. This is pending with the product engineering team and they are working on this feature request and currently there is no ETA. You can follow this Feature Request for further updates. You can also provide your comments or inputs to them in that link.
The official GCP doc on HTTP Load Balancer with Cloud Storage is in Alpha, you will need to request a whitelist to try it. Still you may not be able to solve your problem.
You can also try to use TCP load balancing to set up a pair of backend instance groups, with one of them designated as the failover target, as described in Configure failover for external passthrough Network Load Balancers. For a "mixed backends" topology (i.e., instance groups backend + GCS bucket backend), we can configure path-based routing. But I'm not sure whether/how the GCS bucket can be configured as a failover target.