There are two hooks. An action PostStart is defined before the container starts, and an action PreStop is defined before the container is closed.
Action can be a command or http request
Example
spec:
containers:
- lifecycle:
preStop:
exec:
command:
- curl
- -XPOST
- http://localhost:8080/shutdown
- '&&'
- sleep
- 10s