I am trying to handle prestop event of kuberenetes on my application but I didn't receive any events on my .net core console application
lifecycle:
postStart:
tcpSocket:
port: 13000
preStop:
tcpSocket:
port: 13001
I am receiving on event log
FailedPreStopHook pod/podname-795764db56-9q9pg Cannot run handler: invalid handler: &LifecycleHandler{Exec:nil,HTTPGet:nil,TCPSocket:&TCPSocketAction{Port:{0 13001 },Host:,},}
I have tried another solution to start working with native functions like
[DllImport("Kernel32")]
private static extern bool SetConsoleCtrlHandler(SetConsoleCtrlEventHandler handler, bool add);
But I am able only to run it on windows environment but once I go to linux container I receive error
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'Kernel32' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libKernel32: cannot open shared object file: No such file or directory
Please advice if there is any other solution to this issue to handle closing greacefully for consol application on linux contianer environment.