pod lifecycle

This commit is contained in:
Edward Viaene
2018-08-08 14:39:38 +00:00
parent b7f16e83ba
commit 8b5abe7f14

View File

@@ -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']