Deploying Failure Flags on Google Cloud Run
This document will walk you through setting up Failure Flags for services running on Google Cloud Run. On Cloud Run, Failure Flags is deployed as a sidecar container: Gremlin's failure-flags-sidecar image runs alongside your application container within the same Cloud Run instance.
This guide uses Failure Flags by proxy. In this mode the sidecar intercepts both inbound and outbound HTTP(S) traffic and injects faults at the network level, so no code changes are required. The application container is configured to route its traffic through the sidecar via the HTTP_PROXY and HTTPS_PROXY environment variables.
Configuring Failure Flags for Cloud Run
Cloud Run deployments use the same common configuration options as any other Failure Flags sidecar deployment, plus the proxy mode options below. There are no Cloud Run-specific environment variables required beyond these.
Common and credential options (sidecar container)
Ingress proxy options (sidecar container)
The ingress proxy makes the sidecar the entry point for inbound traffic, forwarding it to your application after Gremlin has had a chance to inject a fault.
Dependency proxy options (sidecar container)
The dependency proxy intercepts your application's outbound HTTP/HTTPS calls so you can inject faults into calls to downstream dependencies.
Application container options
The application containers needs to be configured to route outbound calls through the sidecar's dependency proxy. The exact environment variables/method to accomplish this depends on your application's programming language and libraries, but for most deployments setting HTTP_PROXY/HTTPS_PROXY is sufficient:
Please note that in some common application environments (Java, Node) HTTP_PROXY and HTTPS_PROXY environment variables are not read by default.
Sidecar tuning options
Request-based vs. instance-based billing
Cloud Run services run under one of two billing settings:
- Request-based billing (default): CPU is only allocated to the instance while it's starting up, shutting down, or actively processing a request. Between requests, the instance's access to CPU is severely limited.
- Instance-based billing: CPU is allocated for the entire lifecycle of the instance, whether or not it's currently handling a request.
For request-based billing, the sidecar may be CPU-throttled during idle periods between requests, which may impact sidecar communications with Gremlin's control plane. Increasing GREMLIN_REQUEST_TIMEOUT can mitigate this in request-based billing environments.
Adding the sidecar to your Cloud Run service
Add the sidecar by declaring a second container in your Cloud Run service definition. Here is a yaml of an example application myapplication for deploying in Google Cloud Run:
- The sidecar (
gremlin-sidecar), not the application, is the ingress container. The declaredcontainerPort(5035) is what makes Cloud Run route inbound requests to it. It then forwards each request to the application viaGREMLIN_INGRESS_PROXIED_ENDPOINT(http://localhost:3000). - Outbound traffic is routed back through the sidecar.
myapplicationsetsHTTP_PROXY/HTTPS_PROXYto the sidecar's dependency-proxy address (http://localhost:5034), withNO_PROXYexcludinglocalhostand127.0.0.1so the sidecar's own local traffic isn't recursively routed through itself.
Troubleshooting Failure Flags
The sidecar provides debug logging when the GREMLIN_DEBUG environment variable is set to true. This information is included with your Cloud Run logs and prefixed with [gremlin-sidecar], and will include configuration details, registration status, connection tracing, and any relevant errors encountered while interacting with the control plane.
For additional Failure Flags network request debugging, also set GREMLIN_TRACE to true. Trace logging shows additional network request information, including HTTP requests to the Gremlin API, TLS handshake details, Network timeouts/retries, proxy interactions.

