fluentd-daemonset-elasticsearch.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ---
  2. apiVersion: v1
  3. kind: ServiceAccount
  4. metadata:
  5. name: fluentd
  6. namespace: observe
  7. ---
  8. apiVersion: rbac.authorization.k8s.io/v1
  9. kind: ClusterRole
  10. metadata:
  11. name: fluentd
  12. rules:
  13. - apiGroups:
  14. - ""
  15. resources:
  16. - namespaces
  17. - pods
  18. verbs:
  19. - get
  20. - list
  21. - watch
  22. ---
  23. kind: ClusterRoleBinding
  24. apiVersion: rbac.authorization.k8s.io/v1
  25. metadata:
  26. name: fluentd
  27. roleRef:
  28. kind: ClusterRole
  29. name: fluentd
  30. apiGroup: rbac.authorization.k8s.io
  31. subjects:
  32. - kind: ServiceAccount
  33. name: fluentd
  34. # This namespace setting will limit fluentd to watching/listing/getting pods in the default namespace. If you want it to be able to log your kube-system namespace as well, comment the line out.
  35. namespace: observe
  36. ---
  37. apiVersion: apps/v1
  38. kind: DaemonSet
  39. metadata:
  40. name: fluentd
  41. namespace: observe
  42. labels:
  43. k8s-app: fluentd-logging
  44. version: v1
  45. spec:
  46. selector:
  47. matchLabels:
  48. k8s-app: fluentd-logging
  49. version: v1
  50. template:
  51. metadata:
  52. labels:
  53. k8s-app: fluentd-logging
  54. version: v1
  55. spec:
  56. serviceAccountName: fluentd
  57. tolerations:
  58. - key: node-role.kubernetes.io/control-plane
  59. effect: NoSchedule
  60. - key: node-role.kubernetes.io/master
  61. effect: NoSchedule
  62. containers:
  63. - name: fluentd
  64. image: fluent/fluentd-kubernetes-daemonset:v1-debian-elasticsearch
  65. env:
  66. - name: K8S_NODE_NAME
  67. valueFrom:
  68. fieldRef:
  69. fieldPath: spec.nodeName
  70. - name: FLUENT_ELASTICSEARCH_HOST
  71. value: "elasticsearch-master.observe.svc.cluster.local"
  72. - name: FLUENT_ELASTICSEARCH_PORT
  73. value: "9200"
  74. - name: FLUENT_ELASTICSEARCH_SCHEME
  75. value: "https"
  76. # Option to configure elasticsearch plugin with self signed certs
  77. # ================================================================
  78. - name: FLUENT_ELASTICSEARCH_SSL_VERIFY
  79. value: "false"
  80. # Option to configure elasticsearch plugin with tls
  81. # ================================================================
  82. - name: FLUENT_ELASTICSEARCH_SSL_VERSION
  83. value: "TLSv1_2"
  84. # X-Pack Authentication
  85. # =====================
  86. - name: FLUENT_ELASTICSEARCH_USER
  87. value: "elastic"
  88. - name: FLUENT_ELASTICSEARCH_PASSWORD
  89. value: "12356789"
  90. # Logz.io Authentication
  91. # ======================
  92. #- name: LOGZIO_LOGTYPE
  93. #value: "kubernetes"
  94. resources:
  95. limits:
  96. memory: 500Mi
  97. requests:
  98. cpu: 200m
  99. memory: 200Mi
  100. volumeMounts:
  101. - name: varlog
  102. mountPath: /var/log
  103. # When actual pod logs in /var/lib/docker/containers, the following lines should be used.
  104. # - name: dockercontainerlogdirectory
  105. # mountPath: /var/lib/docker/containers
  106. # readOnly: true
  107. # When actual pod logs in /var/log/pods, the following lines should be used.
  108. - name: dockercontainerlogdirectory
  109. mountPath: /var/log/pods
  110. readOnly: true
  111. terminationGracePeriodSeconds: 30
  112. volumes:
  113. - name: varlog
  114. hostPath:
  115. path: /var/log
  116. # When actual pod logs in /var/lib/docker/containers, the following lines should be used.
  117. # - name: dockercontainerlogdirectory
  118. # hostPath:
  119. # path: /var/lib/docker/containers
  120. # When actual pod logs in /var/log/pods, the following lines should be used.
  121. - name: dockercontainerlogdirectory
  122. hostPath:
  123. path: /var/log/pods