Difference between revisions of "Kubernetes Container Lifecycle Events"

From wikieduonline
Jump to navigation Jump to search
Line 37: Line 37:
  
  
 
+
== See also ==
 
* {{Lifecycle}}
 
* {{Lifecycle}}
 
* {{Pod}}
 
* {{Pod}}
 +
 +
[[Category:K8s]]

Revision as of 19:37, 19 September 2022


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"]


See also

Advertising: