I have an instance group with autoscaler and load-balancer. When some instances are terminated by autoscaler, they are still seen as healthy by load-balancer for a second or two. Because of this some users get 522 error.
https://cloud.google.com/compute/docs/load-balancing/health-checks "You can also add the relevant iptables command to a shutdown script so the instance shuts down more gracefully."
I saw this line in documentation. Maybe someone has a shutdown script example, which could mark my instance as unhealthy for a load-balancer?