deploy-tmp.yaml 6.6 KB

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