apiVersion: v1
kind: Pod
metadata:
  name: lifecycle
  labels:
    name: lifecycle
spec:
  containers:
  - name: lifecycle-container
    image: registry.cn-beijing.aliyuncs.com/joey2020/k8s-test:v1
    lifecycle:
      postStart:
        exec: 
          command:  ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
      preStop:
        exec:
          command:  ["/bin/sh", "-c", "echo Hello from the preStop handler > /usr/share/message"]
