Capturing Heap Dumps of stateless Kubernetes pods before container termination and export to AWS S3

Kubernetes supports executing commands before the container termination. So if we need to capture heap dump in the event of container termination to analyze an issue, we can use a Kubernetes feature called pre-stop hook. We can include the command that we need to execute before container termination to the pre-stop block inside the pod configuration.

command: ["/scripts/"]



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store