k8s-启动、退出动作

vim post.yaml

 1 apiVersion: v1
 2 kind: Pod
 3 metadata:
 4   name: lifecycle-demo
 5 spec:
 6   containers:
 7   - name: lifecycle-demo-container
 8     image: nginx
 9     lifecycle:
10       postStart:
11         exec:
12           command: ["/bin/sh","-c","echo Hello from the postStart handler > /usr/share/message"]
13       preStop:
14         exec:
15           command: ["/bin/sh","-c","echo Hello from the postStop handler >> /usr/share/message"]

 

你可能感兴趣的:(k8s-启动、退出动作)