📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

Your chiseled .NET container has no shell. How do you debug it in production?

Intermediate Coding Intermediate

🎯 Key points

  • Telemetry first: logs, traces, runtime metrics
  • kubectl debug ephemeral container with --target shares the process namespace
  • dotnet-counters for live metrics, dotnet-trace for CPU, dotnet-dump for memory
  • Crash dumps via DOTNET_DbgEnableMiniDump to a mounted volume
  • dotnet-monitor sidecar where kubectl debug isn't available
  • Never add a shell to the production image

⏱ 30-second answer

Don't add a shell back. Start with telemetry: structured logs, traces and runtime metrics (GC heap, thread pool queue length, exceptions) in Application Insights / OpenTelemetry usually narrow it down without touching the container. If you need live diagnostics on Kubernetes, attach an ephemeral debug container: kubectl debug -it <pod> --image=mcr.microsoft.com/dotnet/sdk:10.0 --target=<container> shares the process namespace, so dotnet-counters monitor -p 1 shows live metrics, dotnet-trace collect -p 1 captures a CPU trace and dotnet-dump collect -p 1 takes a memory dump. On Azure Container Apps or App Service, which don't offer kubectl debug, set DOTNET_DbgEnableMiniDump=1 to write crash dumps to mounted storage, or enable dotnet-monitor as a sidecar to collect dumps and traces over HTTP.

🔍 What the interviewer is checking

Checks they know the operational trade-off of distroless images

↩ Usually asked after

More in Containers

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me