hook 钩子函数 生命周期 lifecycle/postStart/preStop


hook-demo1.yaml    lifecycle/postStart
---
apiVersion: v1
kind: Pod
metadata:
    name: hook-demo1
    labels:
        app: hook
spec:
    containers:
    - name: hook-demo1
      image: nginx
      ports:
      - name: webport
          containerPort: 80
      lifecycle:
          postStart:
              exec:
                  command: ["/bin/sh","-c","echo Hello from the postStart Handler > /usr/share/message"]



hook-demo2.yaml    lifecycle/preStop
---
apiVersion: v1
kind: Pod
metadata:
  name: hook-demo2
  labels:
    app: hook
spec:
  containers:
  - name: hook-demo2
    image: nginx
    ports:
    - name: webport
      containerPort: 80
    volumeMounts:
    - name: message
      mountPath: /usr/share/
    lifecycle:
      preStop:
        exec:
          command: ['/bin/sh','-c','echo Hello from the preStop Handler > /usr/share/message']
  volumes:
  - name: message
    hostPath:
      path: /tmp

相关文章:

  • 2021-10-06
  • 2021-10-08
  • 2021-10-03
  • 2021-12-08
  • 2021-11-02
猜你喜欢
  • 2021-12-31
  • 2021-07-12
  • 2021-09-24
  • 2021-07-18
  • 2021-11-12
  • 2021-05-20
相关资源
相似解决方案