k8s lifecycle manifest

This commit is contained in:
2025-10-04 09:56:51 +03:30
parent bec8b349be
commit 1c613282b0

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: lifecycle-demo
spec:
containers:
- name: demo-container
image: nginx
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "echo 'Container started!' > /usr/share/nginx/html/index.html"]
preStop:
exec:
command: ["/bin/sh", "-c", "echo 'Container stopping...' >> /usr/share/nginx/html/index.html && sleep 10"]
terminationGracePeriodSeconds: 15