deploy-tmp.yaml 4.7 KB

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