Sounds like use case for ephemeral containers

Ephemeral containers are useful for interactive troubleshooting when kubectl exec is insufficient because a container has crashed or a container image doesn't include debugging utilities

See also Debugging with an ephemeral debug container

Answer from rkosegi on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › core › diagnostics › dotnet-dump
dotnet-dump diagnostic tool - .NET CLI - .NET | Microsoft Learn
Use dotnet-dump to diagnose deadlock situations where threads are blocked waiting for resources. For a complete deadlock debugging walkthrough, see Debug a deadlock in .NET. Use the threads command to see all managed threads: > threads *0 0x1DBFF (121855) 1 0x1DC01 (121857) 2 0x1DC02 (121858) ... Use clrstack -all to see the call stacks of all threads: ... Look for patterns where multiple threads are blocked on Monitor.Enter or similar synchronization primitives.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › core › diagnostics › dotnet-monitor
dotnet-monitor diagnostic tool - .NET | Microsoft Learn
The dotnet-monitor global tool is a way to monitor .NET applications in production environments and to collect diagnostic artifacts (for example, dumps, traces, logs, and metrics) on-demand or using automated rules for collecting under specified conditions.
🌐
GitHub
github.com › dotnet › dotnet-monitor › blob › main › documentation › api › dump.md
dotnet-monitor/documentation/api/dump.md at main · dotnet/dotnet-monitor
This repository contains the source code for .NET Monitor - a tool that allows you to gather diagnostic data from running applications using HTTP endpoints - dotnet-monitor/documentation/api/dump.md at main · dotnet/dotnet-monitor
Author   dotnet
🌐
Poppastring
poppastring.com › blog › collecting-dumps-anywhere-with-dotnetmonitor
Collecting dumps anywhere with dotnet-monitor - Mark Downie
September 14, 2020 - We have exposed an API surface that covers tracing, metrics, logs, GC dumps and core dumps as follows: ... This product is currently a preview tool that can be installed locally (dotnet tool install -g dotnet-monitor) or as container image.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › core › diagnostics › dumps
Dumps - .NET | Microsoft Learn
February 23, 2026 - Several other debugger tools such as Visual Studio or windbg also have dump collection features. If you are running your app in production or you are running it in a distributed manner (several services, replicas), dotnet-monitor provides support for many common scenarios and ad-hoc diagnostic investigations, including dump collection and egress.
🌐
Dotnetwisdom
dotnetwisdom.co.uk › 2025 › 09 › 28 › from-debugging-to-diagnostics-mastering-dotnet-monitor-counters-and-dumps-in-net-8
From Debugging to Diagnostics: Mastering dotnet-monitor, Counters, and Dumps in .NET 8 – Software Architecture and AI Consultancy
October 1, 2025 - Historically, on Windows one might use tools like Performance Monitor, ETW traces, or crash dumps via WinDbg. In the cross-platform .NET Core era, Microsoft introduced a standardized diagnostic IPC mechanism (EventPipe) and a suite of cross-platform CLI tools. These tools dotnet-counters, dotnet-trace, dotnet-dump and eventually dotnet-monitor leverage EventPipe to collect information from a running .NET process without needing a traditional debugger or profiler attached.
🌐
Microsoft
devblogs.microsoft.com › dev blogs › .net blog › introducing dotnet-monitor, an experimental tool
Introducing dotnet-monitor, an experimental tool - .NET Blog
May 20, 2021 - Known Issue: When running locally the dotnet-monitor tools lists itself as one of the target processes. The /dump endpoint returns a process dump of the target process.
🌐
GitHub
github.com › dotnet › dotnet-monitor
GitHub - dotnet/dotnet-monitor: This repository contains the source code for .NET Monitor - a tool that allows you to gather diagnostic data from running applications using HTTP endpoints · GitHub
You may configure rules to collect diagnostic artifacts when a desired condition is met, for example, collect a process dump when you have sustained high CPU. See Releases for the release history. Docs - Learn how to install, configure, and use dotnet-monitor.
Starred by 706 users
Forked by 125 users
Languages   C# 80.0% | C++ 6.4% | PowerShell 5.1% | Shell 4.4% | CMake 3.0% | Batchfile 0.7%
Find elsewhere
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › core › diagnostics › tools-overview
.NET Diagnostic tools overview - .NET | Microsoft Learn
December 4, 2024 - The dotnet-gcdump tool is a way to collect garbage collector (GC) dumps of live .NET processes. The dotnet-monitor tool is a way to monitor .NET applications in production environments and to collect diagnostic artifacts (for example, dumps, traces, logs, and metrics) on-demand or using automated rules for collecting under specified conditions.
🌐
GitHub
github.com › dotnet › dotnet-monitor › blob › main › documentation › api › gcdump.md
dotnet-monitor/documentation/api/gcdump.md at main · dotnet/dotnet-monitor
This repository contains the source code for .NET Monitor - a tool that allows you to gather diagnostic data from running applications using HTTP endpoints - dotnet-monitor/documentation/api/gcdump.md at main · dotnet/dotnet-monitor
Author   dotnet
🌐
GitHub
github.com › SachiraChin › dotnet-monitor-ui
GitHub - SachiraChin/dotnet-monitor-ui: This project is created as an easy to access user experience for dotnet-monitor tool which can be found here. dotnet-monitor is on demand tool which can be used on .NET Core applications to get memory dumps, traces and metrics of a running application.
July 23, 2020 - /dump endpoint supports one parameter called type. From the UI, user can select supported types and click download to download dump file. More info: https://devblogs.microsoft.com/dotnet/introducing-dotnet-monitor/#dump
Starred by 55 users
Forked by 2 users
Languages   TypeScript 69.2% | HTML 22.6% | SCSS 6.3% | JavaScript 1.9% | TypeScript 69.2% | HTML 22.6% | SCSS 6.3% | JavaScript 1.9%
🌐
Medium
medium.com › @davidsilwal › diagnosing-net-aaf5b6821486
Diagnosing .NET Applications in Docker with dotnet-dump, dotnet-counters, dotnet-gcdump, and dotnet-trace | by David Silwal | Medium
February 19, 2025 - Diagnosing .NET applications running in Docker containers can be complex, but tools like dotnet-dump, dotnet-counters, and dotnet-trace significantly simplify the process. By incorporating these tools into your Dockerfile, you can efficiently collect crash dumps, monitor performance metrics, and capture execution traces, enabling you to identify and resolve runtime issues with greater ease.
🌐
raulnq
blog.raulnq.com › diagnostic-net-apps-using-dotnet-monitor
Diagnostic .NET Apps using dotnet-monitor - raulnq
November 10, 2023 - In production environments, collecting diagnostics such as traces, logs, metrics, and dumps can be challenging. Typically, one must access the environment, install some tools, and then gather the information. dotnet-monitor simplifies and unifies the way of collecting diagnostic information by exposing a REST API, regardless of where your application is being executed (on your local machine, an on-premises server, or within a Kubernetes cluster).
🌐
GitHub
github.com › dotnet › dotnet-monitor › issues › 1053
Capturing dump can cause runtime hang with downstream effects in dotnet-monitor · Issue #1053 · dotnet/dotnet-monitor
Whether invoking the /dump route or invoking the CollectDump action, capturing a dump can cause the target runtime instance to become unresponsive in terms of being able to use the diagnostic pipe. This causes issues in dotnet-monitor when invoking any HTTP API when the dump operation is in progress or when running in listen mode and the process lifetime algorithm is trying to determine whether the target should be pruned.
Author   dotnet
🌐
Scott Hanselman's Blog
hanselman.com › blog › exploring-your-net-applications-with-dotnetmonitor
Exploring your .NET applications with dotnet-monitor - Scott Hanselman's Blog
September 24, 2020 - The dotnet monitor is experimental, but if you're digging it, head over to the dotnet/diagnostics GitHub and show some support. SOS - About the SOS debugger extension. dotnet-dump - Dump collection and analysis utility.
🌐
DeepWiki
deepwiki.com › dotnet › dotnet-monitor
dotnet/dotnet-monitor | DeepWiki
May 23, 2025 - dotnet-monitor is a .NET diagnostic monitoring tool that enables collection of diagnostic artifacts (logs, traces, dumps, metrics) from .NET applications through both on-demand HTTP APIs and automated collection rules.
🌐
GitHub
github.com › dotnet › dotnet-monitor › blob › main › documentation › kubernetes.md
dotnet-monitor/documentation/kubernetes.md at main · dotnet/dotnet-monitor
Dumps Temporary Folder: The dotnet monitor tool is configured to instruct the application runtime to produce dump files at the path specified by the DOTNETMONITOR_Storage__DumpTempFolder environment variable.
Author   dotnet
🌐
Microsoft Learn
learn.microsoft.com › en-us › shows › on-dotnet › diagnosing-net-6-issues-from-sidecar-containers-using-dotnet-monitor
Diagnosing .NET 6 issues from sidecar containers using dotnet-monitor | Microsoft Learn
04:30 - dotnet-monitor hands-on in kubernetes 13:30 - dotnet-monitor process information 15:00 - livemetrics with dotnet-monitor 17:55 - dump with dotnet-monitor to an egress provider 21:30 - analyzing a dump file 28:20 - Wrap-up Recommended resources dotnet-monitor GitHub repo dotnet-monitor ...
🌐
Tessferrandez
tessferrandez.com › blog › 2021 › 03 › 18 › debugging-a-netcore-memory-issue-with-dotnet-dump.html
Debugging .NET Core memory issues (on Linux) with dotnet dump - If broken it is, fix it you should
March 18, 2021 - Run dotnet counters monitor -p [PID] to start looking at the .NET Core counters - We can see that the GC Heap Size increases with around 200 MB each iteration · Run dotnet dump collect -p [PID] to collect a memory dump - watch the process informing us that we are capturing the dump.