Kubernetes 101 : Pods lifecycle hooks - postStart -
The postStart hooks:
A postStart hook is set of instructions, that run after a pod is created. The pods stays in a "pending" state until the postStart "programs" exits.
Below is a Yaml configuration file for a pod, that includes a postStart section:
Our postStart hook above, creates a file in the "/tmp" directory.
We could use the postStart hooks for example to test if a pod fulfills certain criteria - network connection, connection to a database, ... -before allowing it to start.
We create our pod using the below command: