Kubernetes Container Lifecycle Events

From wikieduonline
Revision as of 08:24, 28 October 2022 by Welcome (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Official example

apiVersion: v1

kind: Pod

metadata:

  name: lifecycle-demo

spec:

  containers:

  - name: lifecycle-demo-container

    image: nginx

    lifecycle:

      postStart:

        exec:

          command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]

      preStop:

        exec:

          command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]


Related

See also

Advertising: