-
Notifications
You must be signed in to change notification settings - Fork 0
/
terway-probe.yaml
181 lines (171 loc) · 4.49 KB
/
terway-probe.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
apiVersion: "apps/v1"
kind: "StatefulSet"
metadata:
annotations:
deployment.kubernetes.io/revision: "4"
labels:
app: "nginx"
name: "nginx"
spec:
replicas: 2
revisionHistoryLimit: 10
serviceName: nginx
selector:
matchLabels:
app: "nginx"
template:
metadata:
labels:
app: "nginx"
spec:
automountServiceAccountToken: false
containers:
- name: "container"
image: "docker.io/library/nginx:1.19.0-alpine"
imagePullPolicy: "Always"
lifecycle:
preStop:
exec:
command:
- "sh"
- "-c"
- "sleep 15 || echo 1"
livenessProbe:
failureThreshold: 4
initialDelaySeconds: 484
periodSeconds: 9
successThreshold: 1
tcpSocket:
port: 80
timeoutSeconds: 3
ports:
- containerPort: 80
name: "port-0"
protocol: "TCP"
readinessProbe:
failureThreshold: 4
initialDelaySeconds: 4
periodSeconds: 4
successThreshold: 1
tcpSocket:
port: 80
timeoutSeconds: 3
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: "File"
volumeMounts:
- mountPath: "/etc/nginx/nginx.conf"
subPath: "nginx.conf"
name: "nginx"
initContainers:
- args:
- "-c"
- "(mount -o remount rw /proc/sys && sysctl -w net.core.somaxconn=65535) ||\
\ :"
command:
- "/bin/sh"
image: "docker.io/library/busybox:1.32.0"
imagePullPolicy: "IfNotPresent"
name: "init-sysctl"
resources: {}
securityContext:
capabilities:
add:
- "SYS_ADMIN"
drop:
- "ALL"
procMount: "Default"
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: "File"
restartPolicy: "Always"
schedulerName: "default-scheduler"
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 292
items:
- key: "nginx.conf"
mode: 292
path: "nginx.conf"
name: "nginx"
optional: false
name: "nginx"
---
apiVersion: v1
data:
nginx.conf: |
user nginx;
worker_processes 6;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
kind: ConfigMap
metadata:
name: nginx
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: nginx
spec:
concurrencyPolicy: Allow
failedJobsHistoryLimit: 3
jobTemplate:
metadata:
labels:
app: "nginx"
spec:
template:
spec:
containers:
- args:
- /usr/local/bin/terway-probe
env:
- name: URI
value: "http://nginx-0.nginx.jonathan/"
# 每次发起http 请求时,sleep 的间隔
- name: MILLISECOND
value: "1000"
image: docker.io/jianhaiqing/terway-probe:v1
imagePullPolicy: IfNotPresent
name: probe
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Never
schedulerName: default-scheduler
securityContext: {}
serviceAccountName: terway
terminationGracePeriodSeconds: 30
schedule: '*/1 * * * *'
successfulJobsHistoryLimit: 3
suspend: false
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
clusterIP: None
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: "nginx"
sessionAffinity: None
type: ClusterIP