-
Notifications
You must be signed in to change notification settings - Fork 682
/
Copy path2.0-flink-streaming-platform-web.yaml
264 lines (264 loc) · 7.9 KB
/
2.0-flink-streaming-platform-web.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
---
# 存储
apiVersion: v1
kind: PersistentVolume
metadata:
name: bigdata-sync-flink-streaming-platform-web-mysql
namespace: bigdata-sync
spec:
capacity:
storage: 100Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
local:
path: /k8slpv/bigdata-sync/flink-streaming-platform-web
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- 192.168.90.11
---
# 存储声明
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flink-streaming-platform-web-mysql
namespace: bigdata-sync
spec:
storageClassName: local-storage
volumeName: bigdata-sync-flink-streaming-platform-web-mysql
volumeMode: Filesystem
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
---
# 外部域名
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: flink-streaming-platform-web
namespace: bigdata-sync
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
spec:
rules:
- host: web-bigdata-sync.local.wangjiahuan.com
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: flink-streaming-platform-web
port:
number: 8080
---
# 内部域名
apiVersion: v1
kind: Service
metadata:
name: flink-streaming-platform-web
namespace: bigdata-sync
spec:
type: LoadBalancer
ports:
- name: for-8080
port: 8080
targetPort: 8080
- name: for-3306
port: 3306
targetPort: 3306
selector:
app: flink-streaming-platform-web
#---
## 配置文件
#apiVersion: v1
#kind: ConfigMap
#metadata:
# name: flink-streaming-platform-web
# namespace: bigdata-sync
#data:
# application.properties: |
# ####jdbc信息
# server.port=8080
# spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flink_web?characterEncoding=UTF-8&useSSL=false
# spring.datasource.username=flink_web_test
# spring.datasource.password=flink_web_test_123
---
# 服务
---
# 服务
apiVersion: apps/v1
kind: Deployment
metadata:
name: flink-streaming-platform-web
namespace: bigdata-sync
labels:
app: flink-streaming-platform-web
spec:
replicas: 1
selector:
matchLabels:
app: flink-streaming-platform-web
template:
metadata:
labels:
app: flink-streaming-platform-web
spec:
restartPolicy: Always
initContainers:
- name: wait-jobmanager
image: busybox:latest
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
set -ex
until nc -zv flink-jobmanager 8081; do sleep 5; done
sleep 10
containers:
- name: mysql
image: mysql:8.0.25
imagePullPolicy: IfNotPresent
args:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
ports:
- containerPort: 3306
# livenessProbe:
# tcpSocket:
# port: 3306
# failureThreshold: 10
# periodSeconds: 60
# initialDelaySeconds: 10
env:
- name: TZ
value: Asia/Shanghai
- name: MYSQL_ROOT_PASSWORD
value: UWWDEEH8BZ0gUAX
- name: MYSQL_DATABASE
value: flink_web
- name: MYSQL_USER
value: flink_web_test
- name: MYSQL_PASSWORD
value: flink_web_test_123
volumeMounts:
- mountPath: /var/lib/mysql
name: flink-streaming-platform-web-mysql
resources:
requests:
cpu: 100m
memory: 100Mi
ephemeral-storage: 1Gi
limits:
cpu: 5000m
memory: 5000Mi
ephemeral-storage: 10Gi
- name: flink-streaming-platform-web
image: tanshilindocker/flink-streaming-platform-web:0.0.5
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
# command:
# - sh
# - -c
# - "sleep 99999"
# livenessProbe:
# tcpSocket:
# port: 8000
# failureThreshold: 10
# periodSeconds: 60
# initialDelaySeconds: 10
args:
- -Xmx1888M -Xms1888M -Xmn1536M -XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=512M -XX:+UseConcMarkSweepGC -Xdebug -Xrunjdwp:transport=dt_socket,address=9901,server=y,suspend=n -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses -XX:+CMSClassUnloadingEnabled -XX:+ParallelRefProcEnabled -XX:+CMSScavengeBeforeRemark -XX:ErrorFile=../logs/hs_err_pid%p.log -XX:HeapDumpPath=../logs -XX:+HeapDumpOnOutOfMemoryError
- --server.port=8080
- --spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flink_web?characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
- --spring.datasource.username=flink_web_test
- --spring.datasource.password=flink_web_test_123
- --logging.config=classpath:logging/logback-prod.xml
- --spring.devtools.livereload.enabled=false
env:
- name: TZ
value: Asia/Shanghai
resources:
requests:
cpu: 100m
memory: 100Mi
ephemeral-storage: 1Gi
limits:
cpu: 5000m
memory: 5000Mi
ephemeral-storage: 10Gi
volumeMounts:
- name: flink-config-volume
mountPath: /opt/flink/conf
- mountPath: /app/flink-streaming-platform-web/logs
name: logs-dir
# - mountPath: /app/flink-streaming-platform-web/conf
# name: flink-streaming-platform-web
- name: promtail
image: grafana/promtail:2.2.1
imagePullPolicy: IfNotPresent
args:
- -config.file=/etc/promtail/config.yaml
- -config.expand-env=true
env:
- name: TZ
value: Asia/Shanghai
- name: ENVIRONMENT_NAME
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: REPLICASET_NAME
valueFrom:
fieldRef:
fieldPath: metadata.labels['app']
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- mountPath: /mnt
name: logs-dir
- mountPath: /etc/promtail
name: promtail-config
resources:
requests:
cpu: 50m
memory: 0.05Gi
ephemeral-storage: 1Gi
limits:
cpu: 500m
memory: 0.5Gi
ephemeral-storage: 10Gi
volumes:
- name: flink-streaming-platform-web-mysql
persistentVolumeClaim:
claimName: flink-streaming-platform-web-mysql
# - name: flink-streaming-platform-web
# configMap:
# name: flink-streaming-platform-web
- name: flink-config-volume
configMap:
name: flink-config
items:
- key: flink-conf.yaml
path: flink-conf.yaml
- key: log4j-console.properties
path: log4j-console.properties
- name: promtail-config
configMap:
name: loki-promtail
- name: logs-dir
emptyDir: {}