-
Notifications
You must be signed in to change notification settings - Fork 0
/
pod-readiness-liveness.yaml
88 lines (88 loc) · 2 KB
/
pod-readiness-liveness.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Create Namespace
apiVersion: v1
kind: Namespace
metadata:
name: pod-readiness-liveness-namespace
---
# Create Command based Liveness and Readiness Probes Pod
apiVersion: v1
kind: Pod
metadata:
name: liveness-readiness-exec-pod
namespace: pod-readiness-liveness-namespace
spec:
containers:
- name: app
image: registry.k8s.io/busybox
args:
- /bin/sh
- -c
- touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600
livenessProbe:
exec:
command:
- cat
- /tmp/healthy
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
exec:
command:
- cat
- /tmp/healthy
initialDelaySeconds: 5
periodSeconds: 5
---
# Create HTTP Request based Liveness and Readiness Probes Pod
apiVersion: v1
kind: Pod
metadata:
name: liveness-readiness-http-pod
namespace: pod-readiness-liveness-namespace
spec:
containers:
- name: app
image: registry.k8s.io/liveness
args:
- /server
livenessProbe:
httpGet:
path: /healthz
port: 8080
httpHeaders:
- name: Custom-Header
value: Awesome
initialDelaySeconds: 3
periodSeconds: 3
readinessProbe:
httpGet:
path: /healthz
port: 8080
httpHeaders:
- name: Custom-Header
value: Awesome
initialDelaySeconds: 3
periodSeconds: 3
---
# Create TCP based Liveness and Readiness Probes Pod
apiVersion: v1
kind: Pod
metadata:
name: liveness-readiness-tcp-pod
namespace: pod-readiness-liveness-namespace
spec:
containers:
- name: app
image: registry.k8s.io/goproxy:0.1
ports:
- containerPort: 8080
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 10