fluentd.j2 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. apiVersion: extensions/v1beta1
  2. kind: "DaemonSet"
  3. metadata:
  4. name: "{{ daemonset_name }}"
  5. labels:
  6. provider: openshift
  7. component: "{{ daemonset_component }}"
  8. logging-infra: "{{ daemonset_component }}"
  9. spec:
  10. selector:
  11. matchLabels:
  12. provider: openshift
  13. component: "{{ daemonset_component }}"
  14. updateStrategy:
  15. type: RollingUpdate
  16. rollingUpdate:
  17. minReadySeconds: 600
  18. template:
  19. metadata:
  20. name: "{{ daemonset_container_name }}"
  21. labels:
  22. logging-infra: "{{ daemonset_component }}"
  23. provider: openshift
  24. component: "{{ daemonset_component }}"
  25. spec:
  26. serviceAccountName: "{{ daemonset_serviceAccount }}"
  27. nodeSelector:
  28. {{ fluentd_nodeselector_key }}: "{{ fluentd_nodeselector_value }}"
  29. containers:
  30. - name: "{{ daemonset_container_name }}"
  31. image: "{{ openshift_logging_fluentd_image_prefix }}{{ daemonset_name }}:{{ openshift_logging_fluentd_image_version }}"
  32. imagePullPolicy: Always
  33. securityContext:
  34. privileged: true
  35. resources:
  36. limits:
  37. cpu: {{ openshift_logging_fluentd_cpu_limit }}
  38. memory: {{ openshift_logging_fluentd_memory_limit }}
  39. requests:
  40. memory: {{ openshift_logging_fluentd_memory_limit }}
  41. volumeMounts:
  42. - name: runlogjournal
  43. mountPath: /run/log/journal
  44. - name: varlog
  45. mountPath: /var/log
  46. - name: varlibdockercontainers
  47. mountPath: /var/lib/docker/containers
  48. readOnly: true
  49. - name: config
  50. mountPath: /etc/fluent/configs.d/user
  51. readOnly: true
  52. - name: certs
  53. mountPath: /etc/fluent/keys
  54. readOnly: true
  55. - name: dockerhostname
  56. mountPath: /etc/docker-hostname
  57. readOnly: true
  58. - name: localtime
  59. mountPath: /etc/localtime
  60. readOnly: true
  61. - name: dockercfg
  62. mountPath: /etc/sysconfig/docker
  63. readOnly: true
  64. - name: dockerdaemoncfg
  65. mountPath: /etc/docker
  66. readOnly: true
  67. - name: filebufferstorage
  68. mountPath: /var/lib/fluentd
  69. {% if openshift_logging_mux_client_mode is defined %}
  70. - name: muxcerts
  71. mountPath: /etc/fluent/muxkeys
  72. readOnly: true
  73. {% endif %}
  74. env:
  75. - name: "K8S_HOST_URL"
  76. value: "{{ openshift_logging_fluentd_master_url }}"
  77. - name: "ES_HOST"
  78. value: "{{ app_host }}"
  79. - name: "ES_PORT"
  80. value: "{{ app_port }}"
  81. - name: "ES_CLIENT_CERT"
  82. value: "{{ openshift_logging_fluentd_app_client_cert }}"
  83. - name: "ES_CLIENT_KEY"
  84. value: "{{ openshift_logging_fluentd_app_client_key }}"
  85. - name: "ES_CA"
  86. value: "{{ openshift_logging_fluentd_app_ca }}"
  87. - name: "OPS_HOST"
  88. value: "{{ ops_host }}"
  89. - name: "OPS_PORT"
  90. value: "{{ ops_port }}"
  91. - name: "OPS_CLIENT_CERT"
  92. value: "{{ openshift_logging_fluentd_ops_client_cert }}"
  93. - name: "OPS_CLIENT_KEY"
  94. value: "{{ openshift_logging_fluentd_ops_client_key }}"
  95. - name: "OPS_CA"
  96. value: "{{ openshift_logging_fluentd_ops_ca }}"
  97. - name: "JOURNAL_SOURCE"
  98. value: "{{ openshift_logging_fluentd_journal_source | default('') }}"
  99. - name: "JOURNAL_READ_FROM_HEAD"
  100. value: "{{ openshift_logging_fluentd_journal_read_from_head | lower }}"
  101. - name: "BUFFER_QUEUE_LIMIT"
  102. value: "{{ openshift_logging_fluentd_buffer_queue_limit }}"
  103. - name: "BUFFER_SIZE_LIMIT"
  104. value: "{{ openshift_logging_fluentd_buffer_size_limit }}"
  105. - name: "FLUENTD_CPU_LIMIT"
  106. valueFrom:
  107. resourceFieldRef:
  108. containerName: "{{ daemonset_container_name }}"
  109. resource: limits.cpu
  110. - name: "FLUENTD_MEMORY_LIMIT"
  111. valueFrom:
  112. resourceFieldRef:
  113. containerName: "{{ daemonset_container_name }}"
  114. resource: limits.memory
  115. - name: "FILE_BUFFER_LIMIT"
  116. value: "{{ openshift_logging_fluentd_file_buffer_limit | default('1Gi') }}"
  117. {% if openshift_logging_mux_client_mode is defined %}
  118. - name: "MUX_CLIENT_MODE"
  119. value: "{{ openshift_logging_mux_client_mode }}"
  120. {% endif %}
  121. {% if openshift_logging_install_eventrouter is defined and openshift_logging_install_eventrouter %}
  122. - name: "TRANSFORM_EVENTS"
  123. value: "true"
  124. {% endif %}
  125. {% if openshift_logging_fluentd_remote_syslog is defined and openshift_logging_fluentd_remote_syslog %}
  126. - name: USE_REMOTE_SYSLOG
  127. value: "true"
  128. {% endif %}
  129. {% if openshift_logging_fluentd_remote_syslog_host is defined %}
  130. - name: REMOTE_SYSLOG_HOST
  131. value: "{{ openshift_logging_fluentd_remote_syslog_host }}"
  132. {% endif %}
  133. {% if openshift_logging_fluentd_remote_syslog_port is defined %}
  134. - name: REMOTE_SYSLOG_PORT
  135. value: "{{ openshift_logging_fluentd_remote_syslog_port }}"
  136. {% endif %}
  137. {% if openshift_logging_fluentd_remote_syslog_severity is defined %}
  138. - name: REMOTE_SYSLOG_SEVERITY
  139. value: "{{ openshift_logging_fluentd_remote_syslog_severity }}"
  140. {% endif %}
  141. {% if openshift_logging_fluentd_remote_syslog_facility is defined %}
  142. - name: REMOTE_SYSLOG_FACILITY
  143. value: "{{ openshift_logging_fluentd_remote_syslog_facility }}"
  144. {% endif %}
  145. {% if openshift_logging_fluentd_remote_syslog_remove_tag_prefix is defined %}
  146. - name: REMOTE_SYSLOG_REMOVE_TAG_PREFIX
  147. value: "{{ openshift_logging_fluentd_remote_syslog_remove_tag_prefix }}"
  148. {% endif %}
  149. {% if openshift_logging_fluentd_remote_syslog_tag_key is defined %}
  150. - name: REMOTE_SYSLOG_TAG_KEY
  151. value: "{{ openshift_logging_fluentd_remote_syslog_tag_key }}"
  152. {% endif %}
  153. {% if openshift_logging_fluentd_remote_syslog_use_record is defined %}
  154. - name: REMOTE_SYSLOG_USE_RECORD
  155. value: "{{ openshift_logging_fluentd_remote_syslog_use_record }}"
  156. {% endif %}
  157. {% if openshift_logging_fluentd_remote_syslog_payload_key is defined %}
  158. - name: REMOTE_SYSLOG_PAYLOAD_KEY
  159. value: "{{ openshift_logging_fluentd_remote_syslog_payload_key }}"
  160. {% endif %}
  161. volumes:
  162. - name: runlogjournal
  163. hostPath:
  164. path: /run/log/journal
  165. - name: varlog
  166. hostPath:
  167. path: /var/log
  168. - name: varlibdockercontainers
  169. hostPath:
  170. path: /var/lib/docker/containers
  171. - name: config
  172. configMap:
  173. name: logging-fluentd
  174. - name: certs
  175. secret:
  176. secretName: logging-fluentd
  177. - name: dockerhostname
  178. hostPath:
  179. path: /etc/hostname
  180. - name: localtime
  181. hostPath:
  182. path: /etc/localtime
  183. - name: dockercfg
  184. hostPath:
  185. path: /etc/sysconfig/docker
  186. - name: dockerdaemoncfg
  187. hostPath:
  188. path: /etc/docker
  189. {% if openshift_logging_mux_client_mode is defined %}
  190. - name: muxcerts
  191. secret:
  192. secretName: logging-mux
  193. {% endif %}
  194. - name: filebufferstorage
  195. hostPath:
  196. path: "/var/lib/fluentd"