deploy-tmp.yaml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. ---
  2. apiVersion: apps/v1
  3. kind: StatefulSet
  4. metadata:
  5. name: realtime-yuewen
  6. namespace: pro
  7. labels:
  8. app: realtime-yuewen
  9. spec:
  10. serviceName: realtime-yuewen
  11. replicas: 2
  12. selector:
  13. matchLabels:
  14. app: realtime-yuewen
  15. template:
  16. metadata:
  17. labels:
  18. app: realtime-yuewen
  19. spec:
  20. terminationGracePeriodSeconds: 180
  21. dnsPolicy: ClusterFirstWithHostNet
  22. dnsConfig:
  23. nameservers:
  24. - 223.5.5.5
  25. - 10.26.22.50
  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
  47. # topologyKey: kubernetes.io/hostname
  48. containers:
  49. - name: realtime-yuewen
  50. image: hub.evbj.easou.com/pro/realtime-yuewen:r181360
  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: 40 #60s后启动第一次探测
  93. periodSeconds: 15 # 每隔10s启动一次探测
  94. timeoutSeconds: 3 # 超时时间3s
  95. successThreshold: 1 # 成功1次即表示容器健康
  96. failureThreshold: 5 # 连续5次失败,则判定容器不健康,默认3次
  97. readinessProbe:
  98. tcpSocket:
  99. port: 8080
  100. initialDelaySeconds: 40
  101. periodSeconds: 15
  102. - image: hub.evbj.easou.com/pro/fluent-bit
  103. imagePullPolicy: IfNotPresent
  104. name: fluent-bit
  105. ports:
  106. - containerPort: 2020
  107. name: metrics
  108. protocol: TCP
  109. terminationMessagePath: /dev/termination-log
  110. terminationMessagePolicy: File
  111. volumeMounts:
  112. - name: volume #日志同时挂载在nginx和filebeat中
  113. mountPath: /data
  114. - name: fluent-bit-config
  115. mountPath: /opt/bitnami/fluent-bit/conf/fluent-bit.conf
  116. subPath: fluent-bit.conf
  117. - name: fluent-bit-config-parses
  118. mountPath: /opt/bitnami/fluent-bit/conf/parsers.conf
  119. subPath: parsers.conf
  120. volumes:
  121. - name: fluent-bit-config
  122. configMap:
  123. name: fluent-bit-config-realtime-yuewen
  124. items:
  125. - key: fluent-bit.conf
  126. path: fluent-bit.conf
  127. - name: fluent-bit-config-parses
  128. configMap:
  129. name: fluent-bit-config-realtime-yuewen
  130. items:
  131. - key: parsers.conf
  132. path: parsers.conf
  133. volumeClaimTemplates:
  134. - metadata:
  135. name: volume
  136. spec:
  137. accessModes: [ "ReadWriteOnce" ]
  138. storageClassName: ceph-block
  139. resources:
  140. requests:
  141. storage: 100Gi
  142. ---
  143. apiVersion: v1
  144. kind: Service
  145. metadata:
  146. name: realtime-yuewen-svc
  147. namespace: pro
  148. labels:
  149. app: realtime-yuewen-svc
  150. spec:
  151. type: NodePort
  152. ports:
  153. - port: 80
  154. targetPort: 8080
  155. name: "main"
  156. selector:
  157. app: realtime-yuewen
  158. ---
  159. apiVersion: networking.k8s.io/v1
  160. kind: Ingress
  161. metadata:
  162. name: realtime-yuewen-ingress
  163. namespace: pro
  164. spec:
  165. rules:
  166. - host: ywrealtime.appeasou.com
  167. http:
  168. paths:
  169. - path: /
  170. pathType: Prefix
  171. backend:
  172. service:
  173. name: realtime-yuewen-svc
  174. port:
  175. number: 8080
  176. - host: pro-realtime-yuewen.ieasou.cn
  177. http:
  178. paths:
  179. - path: /
  180. pathType: Prefix
  181. backend:
  182. service:
  183. name: realtime-yuewen-svc
  184. port:
  185. number: 8080
  186. ingressClassName: nginx
  187. ---
  188. apiVersion: v1
  189. kind: ConfigMap
  190. metadata:
  191. name: fluent-bit-config-realtime-yuewen
  192. namespace: pro
  193. data:
  194. fluent-bit.conf: |
  195. [SERVICE]
  196. Flush 5
  197. Daemon off
  198. Log_Level info
  199. [INPUT]
  200. Name tail
  201. Path /data/logs/app/access.log
  202. Mem_Buf_Limit 5MB
  203. Skip_Long_Lines On
  204. Parser json
  205. [OUTPUT]
  206. Name kafka
  207. Match *
  208. Brokers 10.26.22.124:8092,10.26.22.121:8092,10.26.22.120:8092,10.26.22.102:8092,10.26.22.122:8092
  209. Topics test_realtime_yuewen_nginx
  210. Retry_Limit false
  211. # hides errors "Receive failed: Disconnected" when kafka kills idle connections
  212. rdkafka.log.connection.close false
  213. # producer buffer is not included in http://fluentbit.io/documentation/0.12/configuration/memory_usage.html#estimating
  214. rdkafka.queue.buffering.max.kbytes 10240
  215. # for logs you'll probably want this ot be 0 or 1, not more
  216. rdkafka.request.required.acks 1
  217. parsers.conf: |
  218. [PARSER]
  219. Name multiline_pattern
  220. Format regex
  221. Regex ^\\s*$