-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdice.yaml
55 lines (55 loc) · 1.18 KB
/
dice.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
apiVersion: v1
kind: Service
metadata:
name: dice
spec:
clusterIP: None
ports:
- port: 60001
selector:
game: dice
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: dice
spec:
replicas: 2
selector:
matchLabels:
game: dice
serviceName: dice
template:
metadata:
labels:
game: dice
spec:
terminationGracePeriodSeconds: 150
containers:
- image: panshiqu/game_server:1.2
name: game
ports:
- containerPort: 60001
lifecycle:
preStop:
exec:
# killall发送SIGTERM,开始计时
# 等到A:2分钟(sleep 120)系统发送SIGTERM
# 等到B:2分半(terminationGracePeriodSeconds)系统发送SIGKILL
# 若B远小于A,B时发送SIGTERM,B+2时发送SIGKILL,宽限延长2秒
command:
- sh
- -c
- killall server && sleep 120
volumeMounts:
- mountPath: /work
name: work
volumeClaimTemplates:
- metadata:
name: work
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi