apiVersion: v1
kind: Pod
metadata:
    name: lifecycle-demo
spec:
    containers:
        - name: lifecycle-demo-ctr
          image: nginx
          lifecycle:
              postStart:
                  exec:
                      command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/nginx/html/message"]
              preStop:
                  exec:
                      command: ["/bin/sh", "-c", "nginx -s quit; while killall -0 nginx; do sleep 1; done"]

