microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
362 stars 29 forks source link

Feature Request: clean scale to zero support in combination with Application Gateway #1090

Open nlighten opened 7 months ago

nlighten commented 7 months ago

Is your feature request related to a problem? Please describe.
If I configure an Application Gateway in front of an Azure Container App by following the documentation, the default health probe for / is used. This health check will hit my container app with result that it will never scale to 0. As far as I know we cannot configure Application Gateway not to use an health check.

Describe the solution you'd like.
I would like to be able to configure the Application Gateway with an health probe that only hits Envoy Ingress and not the application. This would allow my application to scale to 0. Normally Envoy has a something like an /healthz/ready endpoint for this purpose but on Azure Container Apps this endpoint is not working. Perhaps there is a similar health endpoint but it does not seem to be documented.

Describe alternatives you've considered.
Configuring an health probe with a non-existing domain name as host header, e.g. ingress.foobar-abcdef.westeurope.azurecontainerapps.io. This health probe will get a 403 response. We can then configure this 403 as the expected response code in the Application Gateway.

While this solution seems to work, it is not a very clean solution that can potentially break if issues like #928 and #755 are fixed.

Additional context.
none

rajravat commented 7 months ago

I too am having to deal with this issue, its currently costing £1.41/day! vs 0 for my other container apps that arent behind the app gateway.

I've currently changed the min replica count to be 1 for the one behind the app gateway, this looks like it makes it eligible for idle billing which has brought down the cost to ~ 41p/day - still not ideal.

anrub commented 2 months ago

For someone reading here, another workaround could be to increase the health probe_interval of the AGW backend pool to be really high, so the app only starts once a day or something like this.