deploy-tmp.yaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. ---
  2. apiVersion: apps/v1
  3. kind: StatefulSet
  4. metadata:
  5. name: realtime-yuewen-v2
  6. namespace: pro
  7. labels:
  8. app: realtime-yuewen-v2
  9. spec:
  10. serviceName: realtime-yuewen-v2
  11. replicas: 3
  12. selector:
  13. matchLabels:
  14. app: realtime-yuewen-v2
  15. template:
  16. metadata:
  17. labels:
  18. app: realtime-yuewen-v2
  19. spec:
  20. terminationGracePeriodSeconds: 30
  21. dnsPolicy: None
  22. dnsConfig:
  23. nameservers:
  24. - 10.108.30.101
  25. - 223.5.5.5
  26. initContainers:
  27. - name: init
  28. image: hub.evbj.easou.com/dev/busybox
  29. command: [ "chmod","777","-R","/data" ]
  30. imagePullPolicy: IfNotPresent
  31. volumeMounts:
  32. - name: volume
  33. mountPath: /data
  34. #nodeSelector:
  35. # app.touchrs: touchrs
  36. # affinity:
  37. # podAntiAffinity:
  38. # preferredDuringSchedulingIgnoredDuringExecution:
  39. # - weight: 100
  40. # podAffinityTerm:
  41. # labelSelector:
  42. # matchExpressions:
  43. # - key: app
  44. # operator: In
  45. # values:
  46. # - realtime-yuewen-v2
  47. # topologyKey: kubernetes.io/hostname
  48. containers:
  49. - name: realtime-yuewen-v2
  50. image: hub.evbj.easou.com/pro/realtime-yuewen-v2:r188999
  51. imagePullPolicy: IfNotPresent
  52. env:
  53. - name: MY_NODE_NAME
  54. valueFrom:
  55. fieldRef:
  56. fieldPath: spec.nodeName
  57. - name: MY_POD_IP
  58. valueFrom:
  59. fieldRef:
  60. fieldPath: status.podIP
  61. - name: MY_POD_NAME
  62. valueFrom:
  63. fieldRef:
  64. fieldPath: metadata.name
  65. - name: MY_POD_NAMESPACE
  66. valueFrom:
  67. fieldRef:
  68. fieldPath: metadata.namespace
  69. - name: JAVA_OPTS
  70. value: "-server -Xmx2g -Xms2g -Xss512k -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=product"
  71. ports:
  72. - containerPort: 8080
  73. name: port
  74. - containerPort: 8001
  75. name: "jvm-debug"
  76. volumeMounts:
  77. - name: volume
  78. mountPath: /data
  79. lifecycle:
  80. preStop:
  81. exec:
  82. command: ["/bin/sh","-c","curl -H 'loginName:admin' -H 'password:ea1so2ua3dm4in5' -X POST 127.0.0.1:8080/actuator/shutdown"]
  83. livenessProbe:
  84. httpGet:
  85. path: /actuator/health
  86. port: 8080
  87. httpHeaders:
  88. - name: loginName
  89. value: admin
  90. - name: password
  91. value: ea1so2ua3dm4in5
  92. initialDelaySeconds: 10 #60s后启动第一次探测
  93. periodSeconds: 10 # 每隔10s启动一次探测
  94. timeoutSeconds: 3 # 超时时间3s
  95. successThreshold: 1 # 成功1次即表示容器健康
  96. failureThreshold: 2 # 连续5次失败,则判定容器不健康,默认3次
  97. readinessProbe:
  98. tcpSocket:
  99. port: 8080
  100. initialDelaySeconds: 40
  101. periodSeconds: 15
  102. - image: hub.evbj.easou.com/dev/flume:1.7.0-20230811
  103. imagePullPolicy: IfNotPresent
  104. name: flume
  105. volumeMounts:
  106. - name: volume #日志同时挂载在nginx和filebeat中
  107. mountPath: /data
  108. volumes:
  109. - name: flume-config
  110. configMap:
  111. name: flume-config-realtime-yuewen-v2
  112. items:
  113. - key: flume.conf
  114. path: flume.conf
  115. volumeClaimTemplates:
  116. - metadata:
  117. name: volume
  118. spec:
  119. accessModes: [ "ReadWriteOnce" ]
  120. storageClassName: rbd
  121. resources:
  122. requests:
  123. storage: 100Gi
  124. ---
  125. apiVersion: v1
  126. kind: Service
  127. metadata:
  128. name: realtime-yuewen-v2-svc
  129. namespace: pro
  130. labels:
  131. app: realtime-yuewen-v2-svc
  132. spec:
  133. type: NodePort
  134. ports:
  135. - port: 80
  136. targetPort: 8080
  137. name: "main"
  138. selector:
  139. app: realtime-yuewen-v2
  140. ---
  141. apiVersion: networking.k8s.io/v1
  142. kind: Ingress
  143. metadata:
  144. name: realtime-yuewen-v2-ingress
  145. namespace: pro
  146. spec:
  147. rules:
  148. - host: ywrealtimev2.appeasou.com
  149. http:
  150. paths:
  151. - path: /
  152. pathType: Prefix
  153. backend:
  154. service:
  155. name: realtime-yuewen-v2-svc
  156. port:
  157. number: 8080
  158. - host: pro-realtime-yuewen-v2.ieasou.cn
  159. http:
  160. paths:
  161. - path: /
  162. pathType: Prefix
  163. backend:
  164. service:
  165. name: realtime-yuewen-v2-svc
  166. port:
  167. number: 8080
  168. ingressClassName: nginx
  169. ---
  170. apiVersion: v1
  171. kind: ConfigMap
  172. metadata:
  173. name: flume-config-realtime-yuewen-v2
  174. namespace: pro
  175. data:
  176. flume.conf: |
  177. a1.channels.c1.type = org.apache.flume.channel.kafka.KafkaChannel
  178. a1.channels.c1.kafka.bootstrap.servers = 10.26.27.71:8092,10.26.22.102:8092,10.26.22.120:8092,10.26.22.121:8092,10.26.22.122:8092
  179. a1.channels.c1.kafka.topic = yuewen_buydetail
  180. a1.channels.c1.kafka.consumer.group.id = flume2kafka
  181. # Define an Avro source called r1 on a1 and tell it
  182. # to bind to 0.0.0.0:41414. Connect it to channel c1.
  183. #注意这里分出2个channel出来,一个是到k1,一个到k2
  184. #如果这里只出一个channel c1的话,下面2个sink channel都为c1,则消息就会随机分到2个sink上,而不是2个sink都有一份
  185. a1.sources.r1.channels = c1
  186. a1.sources.r1.type = exec
  187. a1.sources.r1.command = tail -F /data/logs/app/access.log
  188. a1.sources.r1.restart = true
  189. a1.sources.r1.selector.optional = c1
  190. a1.sources.r1.batchSize = 100000
  191. a1.sources.r1.interceptors = i1 i2 i3
  192. a1.sources.r1.interceptors.i1.type = timestamp
  193. a1.sources.r1.interceptors.i2.type = host
  194. a1.sources.r1.interceptors.i2.useIP = false
  195. a1.sources.r1.interceptors.i3.type = regex_filter
  196. a1.sources.r1.interceptors.i3.regex = ^\\s*$
  197. a1.sources.r1.interceptors.i3.excludeEvents = true
  198. #默认是replicationg,还有multiplexer
  199. #a1.sources.r1.selector.type = replicationg
  200. # Finally, now that we've defined all of our components, tell
  201. # a1 which ones we want to activate.
  202. a1.sources = r1
  203. a1.channels = c1
  204. a1.sinks =