deploy-tmp.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. ---
  2. apiVersion: v1
  3. kind: ConfigMap
  4. metadata:
  5. name: filebeat-config
  6. namespace: qa
  7. data:
  8. filebeat.yml: |
  9. filebeat.inputs:
  10. - type: log
  11. paths:
  12. - "/data/logs/app/all.log"
  13. setup.template.name: "filebeat"
  14. setup.template.pattern: "filebeat-*"
  15. setup.dashboards.enabled: true
  16. setup.template.enabled: true
  17. output.elasticsearch:
  18. username: ${ELASTICSEARCH_USERNAME}
  19. password: ${ELASTICSEARCH_PASSWORD}
  20. #hosts: ${ELASTICSEARCH_HOST}
  21. hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
  22. index: "frontend-filebeat"
  23. setup.kibana:
  24. host: '${KIBANA_HOST:kibana}:${KIBANA_PORT:5601}'
  25. ---
  26. apiVersion: apps/v1
  27. kind: StatefulSet
  28. metadata:
  29. name: offline-process-charge
  30. namespace: qa
  31. labels:
  32. app: offline-process-charge
  33. spec:
  34. serviceName: offline-process-charge
  35. replicas: 1
  36. selector:
  37. matchLabels:
  38. app: offline-process-charge
  39. template:
  40. metadata:
  41. labels:
  42. app: offline-process-charge
  43. spec:
  44. terminationGracePeriodSeconds: 60
  45. initContainers:
  46. - name: init
  47. image: hub.evbj.easou.com/dev/busybox
  48. command: [ "chmod","777","-R","/data" ]
  49. imagePullPolicy: Always
  50. volumeMounts:
  51. - name: volume
  52. mountPath: /data
  53. #nodeSelector:
  54. # app.touchrs: touchrs
  55. containers:
  56. - name: offline-process-charge
  57. image: hub.evbj.easou.com/qa/offline-process-charge:v1.0.39
  58. imagePullPolicy: Always
  59. env:
  60. - name: JAVA_OPTS
  61. value: "-server -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=n -Xmx2g -Xms2g -Xss512k -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=test"
  62. ports:
  63. - containerPort: 8080
  64. name: port
  65. - containerPort: 8001
  66. name: "jvm-debug"
  67. volumeMounts:
  68. - name: volume
  69. mountPath: /data
  70. lifecycle:
  71. preStop:
  72. exec:
  73. command: ["/bin/sh","-c","curl -X POST 127.0.0.1:8080/actuator/shutdown"]
  74. livenessProbe:
  75. httpGet:
  76. path: /actuator/health
  77. port: 8080
  78. httpHeaders:
  79. - name: Custom-Header
  80. value: Awesome
  81. - name: Custom-Header
  82. value: Awesome
  83. initialDelaySeconds: 30 #60s后启动第一次探测
  84. periodSeconds: 10 # 每隔10s启动一次探测
  85. timeoutSeconds: 3 # 超时时间3s
  86. successThreshold: 1 # 成功1次即表示容器健康
  87. failureThreshold: 5 # 连续5次失败,则判定容器不健康,默认3次
  88. readinessProbe:
  89. tcpSocket:
  90. port: 8080
  91. initialDelaySeconds: 30
  92. periodSeconds: 15
  93. - image: docker.elastic.co/beats/filebeat:6.8.12
  94. imagePullPolicy: Always
  95. name: filebeat
  96. env:
  97. - name: ELASTICSEARCH_HOST
  98. value: elasticsearch
  99. - name: ELASTICSEARCH_PORT
  100. value: "9200"
  101. - name: ELASTICSEARCH_USERNAME
  102. value: elastic
  103. - name: ELASTICSEARCH_PASSWORD
  104. value: changeme
  105. - name: KIBANA_HOST
  106. value: kibana
  107. - name: KIBANA_PORT
  108. value: "5601"
  109. volumeMounts:
  110. - name: volume #日志同时挂载在nginx和filebeat中
  111. mountPath: /data
  112. - name: filebeat-config
  113. mountPath: /usr/share/filebeat/filebeat.yml
  114. subPath: filebeat.yml
  115. volumes:
  116. - name: filebeat-config
  117. configMap:
  118. name: filebeat-config
  119. items:
  120. - key: filebeat.yml
  121. path: filebeat.yml
  122. volumeClaimTemplates:
  123. - metadata:
  124. name: volume
  125. spec:
  126. accessModes: [ "ReadWriteOnce" ]
  127. storageClassName: rbd
  128. resources:
  129. requests:
  130. storage: 100Gi
  131. ---
  132. apiVersion: v1
  133. kind: Service
  134. metadata:
  135. name: offline-process-charge-svc
  136. namespace: qa
  137. labels:
  138. app: offline-process-charge-svc
  139. spec:
  140. type: NodePort
  141. ports:
  142. - port: 80
  143. targetPort: 8080
  144. name: "main"
  145. selector:
  146. app: offline-process-charge
  147. ---
  148. apiVersion: extensions/v1beta1
  149. kind: Ingress
  150. metadata:
  151. name: offline-process-charge-ingress
  152. namespace: qa
  153. annotations:
  154. kubernetes.io/ingress.class: nginx
  155. spec:
  156. rules:
  157. - host: qa-offline-process-charge.ieasou.cn
  158. http:
  159. paths:
  160. - path: /
  161. backend:
  162. serviceName: offline-process-charge-svc
  163. servicePort: 80