From 8b5abe7f1419697edf9263c4e154a6162c22a6f2 Mon Sep 17 00:00:00 2001 From: Edward Viaene Date: Wed, 8 Aug 2018 14:39:38 +0000 Subject: [PATCH] pod lifecycle --- pod-lifecycle/lifecycle.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pod-lifecycle/lifecycle.yaml diff --git a/pod-lifecycle/lifecycle.yaml b/pod-lifecycle/lifecycle.yaml new file mode 100644 index 0000000..30ff50a --- /dev/null +++ b/pod-lifecycle/lifecycle.yaml @@ -0,0 +1,35 @@ +kind: Deployment +apiVersion: apps/v1beta1 +metadata: + name: lifecycle +spec: + replicas: 1 + template: + metadata: + labels: + app: lifecycle + spec: + initContainers: + - name: init + image: busybox + command: ['sh', '-c', 'sleep 10'] + containers: + - name: lifecycle-container + image: busybox + command: ['sh', '-c', 'echo $(date +%s): Running >> /timing && echo "The app is running!" && /bin/sleep 120'] + readinessProbe: + exec: + command: ['sh', '-c', 'echo $(date +%s): readinessProbe >> /timing'] + initialDelaySeconds: 35 + livenessProbe: + exec: + command: ['sh', '-c', 'echo $(date +%s): livenessProbe >> /timing'] + initialDelaySeconds: 35 + timeoutSeconds: 30 + lifecycle: + postStart: + exec: + command: ['sh', '-c', 'echo $(date +%s): postStart >> /timing && sleep 10 && echo $(date +%s): end postStart >> /timing'] + preStop: + exec: + command: ['sh', '-c', 'echo $(date +%s): preStop >> /timing && sleep 10']