mirror of
https://github.com/wardviaene/kubernetes-course.git
synced 2026-07-10 14:19:31 +00:00
39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
kind: Deployment
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: lifecycle
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: lifecycle
|
|
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']
|