apiVersion: v1
kind: Pod
metadata:
name: lifecycle-demo
spec:
containers:
- name:lifecycle-demo-container
image: nginx
1ifecycle:
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 poststop handler> /usr/share/message"]