apiVersion: v1
kind: Pod
metadata:
  name: pod-prestop
spec:
  volumes:
  - name: vol-prestop
    hostPath:
      path: /tmp
  containers:
  - name: prestop-pod-container
    image: registry.cn-beijing.aliyuncs.com/wangxiaochun/busybox:1.32.0    
    volumeMounts:       
    - name: vol-prestop
      mountPath: /tmp
    command: ['sh', '-c', 'echo The app is running at $(date)  && sleep 3600']
    lifecycle:
      postStart:
        exec:
          command: ['/bin/sh', '-c','echo lifecycle poststart at $(date) > /tmp/poststart.log']
      preStop:
        exec:
          command: ['/bin/sh', '-c', 'echo lifecycle prestop at $(date)  > /tmp/prestop.log']
