Skip to main content

Agent Proxy Shutdown via HTTP

Introduction​

In certain scenarios, it may be necessary to manually shut down the Agent Proxy when the main container has exited, but the sidecar process continues to run. Instead of terminating the entire job, which may appear as a cancelled job, Aembit offers a solution to gracefully terminate the job while allowing the sidecar to continue operating.

Agent Proxy Shutdown​

The Agent Proxy can be shut down by sending an HTTP POST request to its /quit endpoint.

Example Command​

An example command using curl:

curl -X POST localhost:<HEALTH_CHECK_PORT>/quit

When the Agent Proxy is properly configured to receive this request, it will flush any remaining events to the backend before exiting gracefully.

Configuration Flags​

The behavior of the Agent Proxy can be controlled through specific environment variables outlined below:

AEMBIT_ENABLE_HTTP_SHUTDOWN Environment Variable

This variable controls whether the Agent Proxy supports the /quit endpoint.

  • Default Value: false
  • Accepted Values: false or true

AEMBIT_SERVICE_PORT Environment Variable

This variable specifies the port on which the Agent Proxy responds to the diagnostic and configuration endpoint /quit.

  • Default Value: 51234
  • Accepted Values: an integer number in the range 1 to 65535 (inclusive)

Accessibility and Security Considerations​

info

Handler endpoints, including /quit, are only accessible via localhost or 127.0.0.1. This setting is non-configurable to ensure security.

warning

The /quit handler should only be enabled in fully trusted environments. When enabled, any application with network access to 127.0.0.1 can send a request to shut down the Agent Proxy.

info

The /quit handler is intended for use primarily within Kubernetes environments.