Hello everyone. I’m trying to spawn a daemon process inside a pod using the two-fork and setsid technique.
This scenario works well when I do it in a regular Linux environment: there are no defunct processes at any step. However, when I try to do this in a Kubernetes pod, I get a defunct
record (of the grandchild process) when the grandchild process exits.
I think the reason for this is that my app process is an init
process with PID 1, and the new daemonized process is still its child in the pod (which is not the case in the regular Linux environment).
Does anyone have any ideas on how to daemonize a process in a Kubernetes pod without creating zombie processes?