五、启动、退出动作

main containers启动之前还会有个start动作,结束后有个stop动作

示例:

apiVersion: v1
kind: Pod
metadata:
  name: lifecycle-demo
spec:
  containers:
  - name: lifecycle-demo-nginx
    image: nginx:1.15
    lifecycle:
      postStart:
        exec:
          command: ["/bin/sh","-c","echo hello world >/root/test"]
      postStop:
        exec:
          command: ["/usr/sbin/nginx","-s","quit"]

 

 

posted @ 2019-11-29 15:28  xw115428  阅读(169)  评论(0编辑  收藏  举报