-
Notifications
You must be signed in to change notification settings - Fork 2
/
mypig-k8s.yaml
executable file
·297 lines (275 loc) · 6.64 KB
/
mypig-k8s.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
apiVersion: v1
kind: Namespace
metadata:
name: mypig
labels:
name: mypig
#############################
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: mypig-sa
namespace: mypig
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: mypig-r
namespace: mypig
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: mypig-cr
namespace: mypig
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: mypig-rb
namespace: mypig
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: mypig-r
subjects:
- kind: ServiceAccount
name: mypig-sa
namespace: mypig
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: mypig-rb
namespace: mypig
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: mypig-cr
subjects:
- kind: ServiceAccount
name: mypig-sa
namespace: mypig
#############################
---
apiVersion: v1
kind: Service
metadata:
name: mypig-redis
namespace: mypig
spec:
type: NodePort
selector:
app: mypig-redis
release: latest
ports:
- name: tcp
targetPort: 6379
port: 6379
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mypig-redis
namespace: mypig
spec:
replicas: 1
selector:
matchLabels:
app: mypig-redis
release: latest
template:
metadata:
labels:
app: mypig-redis
release: latest
spec:
serviceAccountName: mypig-sa
containers:
- name: mypig-redis
image: redis
imagePullPolicy: IfNotPresent
ports:
- name: tcp
containerPort: 6379
############################################
---
apiVersion: v1
kind: Service
metadata:
name: mypig-eureka-server
namespace: mypig
spec:
type: NodePort
selector:
app: mypig-eureka-server
release: v1.0
ports:
- name: http
targetPort: 11100
port: 11100
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mypig-eureka-server
namespace: mypig
spec:
replicas: 1
selector:
matchLabels:
app: mypig-eureka-server
release: v1.0
template:
metadata:
labels:
app: mypig-eureka-server
release: v1.0
spec:
serviceAccountName: mypig-sa
containers:
- name: mypig-eureka-server
image: forsrc/mypig-eureka-server:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 11100
livenessProbe:
httpGet:
path: /actuator/health
port: 11100
############################################
---
apiVersion: v1
kind: Service
metadata:
name: mypig-sso-server
namespace: mypig
spec:
type: NodePort
selector:
app: mypig-sso-server
release: v1.0
ports:
- name: http
targetPort: 10000
port: 10000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mypig-sso-server
namespace: mypig
spec:
replicas: 1
selector:
matchLabels:
app: mypig-sso-server
release: v1.0
template:
metadata:
labels:
app: mypig-sso-server
release: v1.0
spec:
serviceAccountName: mypig-sa
containers:
- name: mypig-sso-server
image: forsrc/mypig-sso-server:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 10000
env:
- name: SSO_SERVER-
value: https://sso.mypig.com
- name: JAVA_OPTS
value: -Dspring.thymeleaf.prefix=file:config/templates/
livenessProbe:
httpGet:
path: /sso/actuator/health
port: 10000
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: mypig-sso-server
namespace: mypig
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: sso.mypig.com
http:
paths:
- path:
backend:
serviceName: mypig-sso-server
servicePort: 10000
tls:
- hosts:
- sso.mypig.com
secretName: sso.mypig.com
# openssl genrsa -out sso.mypig.com.key 2048
# openssl req -new -x509 -key sso.mypig.com.key -out sso.mypig.com.crt -subj /C=CN/ST=forsrc/L=forsrc/O=devops/CN=sso.mypig.com
# kubectl create secret tls sso.mypig.com --cert=sso.mypig.com.crt --key=sso.mypig.com.key
############################################
---
apiVersion: v1
kind: Service
metadata:
name: mypig-tcc
namespace: mypig
spec:
type: NodePort
selector:
app: mypig-tcc
release: v1.0
ports:
- name: http
targetPort: 10020
port: 10020
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mypig-tcc
namespace: mypig
spec:
replicas: 1
selector:
matchLabels:
app: mypig-tcc
release: v1.0
template:
metadata:
labels:
app: mypig-tcc
release: v1.0
spec:
serviceAccountName: mypig-sa
containers:
- name: mypig-tcc
image: forsrc/mypig-tcc:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 10020
env:
- name: SSO_SERVER-
value: https://sso.mypig.com
- name: JAVA_OPTS
value: -Dspring.thymeleaf.prefix=file:config/templates/
livenessProbe:
httpGet:
path: /tcc/actuator/health
port: 10020