-
Notifications
You must be signed in to change notification settings - Fork 575
/
statefulset.yaml
121 lines (121 loc) · 2.99 KB
/
statefulset.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
apiVersion: v1
kind: Service
metadata:
name: orange-gateway-a-headless
spec:
# 这个决定了未准备好的endpoints是否在DNS的记录中
publishNotReadyAddresses: true
clusterIP: None
selector:
app: orange-gateway-a
---
apiVersion: v1
kind: Service
metadata:
name: orange-gateway-b-headless
spec:
# 这个决定了未准备好的endpoints是否在DNS的记录中
publishNotReadyAddresses: true
clusterIP: None
selector:
app: orange-gateway-b
---
apiVersion: v1
kind: Service
metadata:
name: orange-gateway-a
spec:
selector:
app: orange-gateway-a
ports:
- port: 80
name: web
targetPort: 80
nodePort: 30080
- port: 7777
name: api
targetPort: 7777
nodePort: 30077
- port: 9999
name: admin
targetPort: 9999
nodePort: 30099
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: orange-gateway-b
spec:
selector:
app: orange-gateway-b
ports:
- port: 80
name: web
targetPort: 80
nodePort: 30081
- port: 7777
name: api
targetPort: 7777
nodePort: 30078
- port: 9999
name: admin
targetPort: 9999
nodePort: 30100
type: NodePort
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: orange-gateway-a
spec:
# 指定StatefulSet控制器要使用这个Headless Service
serviceName: orange-gateway-a-headless
replicas: 1
selector:
matchLabels:
app: orange-gateway-a
template:
metadata:
labels:
app: orange-gateway-a
spec:
containers:
- name: orange-gateway-a
image: wangxiaowu950330/orange:v1
imagePullPolicy: IfNotPresent
env:
- name: ORANGE_HOST
value: orange-gateway-a-0.orange-gateway-a-headless.default.svc.cluster.local
ports:
- containerPort: 80
- containerPort: 7777
- containerPort: 9999
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: orange-gateway-b
spec:
# 指定StatefulSet控制器要使用这个Headless Service
serviceName: orange-gateway-b-headless
replicas: 1
selector:
matchLabels:
app: orange-gateway-b
template:
metadata:
labels:
app: orange-gateway-b
spec:
containers:
- name: orange-gateway-b
image: wangxiaowu950330/orange:v1
imagePullPolicy: IfNotPresent
env:
- name: ORANGE_HOST
value: orange-gateway-b-0.orange-gateway-b-headless.default.svc.cluster.local
ports:
- containerPort: 80
- containerPort: 7777
- containerPort: 9999