apiVersion: v1
kind: Pod
metadata:
  name: hook-demo2
spec:
  containers:
  - name: hook-demo2
    image: nginx
    volumeMounts:
    - name: message
      mountPath: /usr/share

    lifecycle:
      preStop:
        exec:
          command: ["/bin/sh", "-c", "echo Hello from the postStop handler > /usr/share/message"]
      # preStop:
      #   exec:
      #     command: ["/usr/sbin/nginx","-s","quit"]
  volumes:
  - name: message
    hostPath:
      path: /tmp
