This repository contains the source code for .NET Monitor - a tool that allows you to gather diagnostic data from running applications using HTTP endpoints
Originally posted by **agobezy** June 21, 2024
I've been looking into this issue for the entire day and wanted to get some advice.
Environment details:
1. Azure Kubernetes Cluster
2. Single pod running two containers (dotnet app and dotnet monitor)
3. Dotnet monitor image - mcr.microsoft.com/dotnet/monitor:8
Kubernetes allows you to run commands before a pod is terminated. The preStop is working on the dotnet app. The dotnet monitor stops instantly and leads to a server error.
![image](https://github.com/dotnet/dotnet-monitor/assets/105251934/7e3f267c-71f5-41ee-b731-fc2f4eb545e9)
![image](https://github.com/dotnet/dotnet-monitor/assets/105251934/ea60b1c3-37e6-46f8-9fd7-78f3b0d32e95)
![image](https://github.com/dotnet/dotnet-monitor/assets/105251934/0dbbd35c-08ba-4210-a8c2-7d69cf8e51a1)
![image](https://github.com/dotnet/dotnet-monitor/assets/105251934/1bd907fd-228c-4886-b09b-a9f72dc762e6)
Troubleshooting attempted:
1. Following https://pracucci.com/graceful-shutdown-of-kubernetes-pods.html and setting a terminationGracePeriod of 300 seconds
Can the dotnet monitor process gracefully shutdown instead of terminating instantly?
Discussed in https://github.com/dotnet/dotnet-monitor/discussions/6865