I'm using preStop command to gracefully shutdown my server application when I delete a pod. What is the state of the pod/ container when it runs preStop command? For example, does it stop the network interfaces before running the preStop command?
lifecycle:
    preStop:
      exec:                
        command: ["kill", "-SIGTERM", "`pidof java`"]The state of the pod doesn't change while preStop hooks are run -- the preStop hook is run in the container, and then the container is stopped.
When a pod should be terminated, Kubernetes does the following:
Terminating statepreStop hook (if any)preStop hook ends, it sends a SIGTERM to the main process in the container (PID 1)SIGKILL to the container's main process to violently stop itMore details here: Graceful shutdown of Kubernetes Pods