ktimoney | 90fcec9 | 2022-04-29 15:46:50 +0100 | [diff] [blame^] | 1 | apiVersion: v1 |
| 2 | kind: ServiceAccount |
| 3 | metadata: |
| 4 | name: fluentd |
| 5 | namespace: kube-system |
| 6 | --- |
| 7 | apiVersion: rbac.authorization.k8s.io/v1 |
| 8 | kind: ClusterRole |
| 9 | metadata: |
| 10 | name: fluentd |
| 11 | namespace: kube-system |
| 12 | rules: |
| 13 | - apiGroups: |
| 14 | - "" |
| 15 | resources: |
| 16 | - pods |
| 17 | - namespaces |
| 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 | namespace: kube-system |
| 35 | --- |
| 36 | apiVersion: apps/v1 |
| 37 | kind: DaemonSet |
| 38 | metadata: |
| 39 | name: fluentd |
| 40 | namespace: kube-system |
| 41 | labels: |
| 42 | k8s-app: fluentd-logging |
| 43 | version: v1 |
| 44 | spec: |
| 45 | selector: |
| 46 | matchLabels: |
| 47 | k8s-app: fluentd-logging |
| 48 | version: v1 |
| 49 | template: |
| 50 | metadata: |
| 51 | labels: |
| 52 | k8s-app: fluentd-logging |
| 53 | version: v1 |
| 54 | spec: |
| 55 | tolerations: |
| 56 | - key: node-role.kubernetes.io/master |
| 57 | effect: NoSchedule |
| 58 | containers: |
| 59 | - name: fluentd |
| 60 | image: fluent/fluentd-kubernetes-daemonset:v1-debian-elasticsearch |
| 61 | env: |
| 62 | - name: FLUENT_ELASTICSEARCH_HOST |
| 63 | value: "elasticsearch.logging" |
| 64 | - name: FLUENT_ELASTICSEARCH_PORT |
| 65 | value: "9200" |
| 66 | - name: FLUENT_ELASTICSEARCH_SCHEME |
| 67 | value: "https" |
| 68 | - name: FLUENTD_SYSTEMD_CONF |
| 69 | value: 'disable' |
| 70 | - name: K8S_NODE_NAME |
| 71 | value: 'docker-cluster' |
| 72 | #- name: FLUENT_CONTAINER_TAIL_PARSER_TYPE |
| 73 | #value: /^(?<time>.+) (?<stream>stdout|stderr) [^ ]* (?<log>.*)$/ |
| 74 | # Option to configure elasticsearch plugin with self signed certs |
| 75 | # ================================================================ |
| 76 | - name: FLUENT_ELASTICSEARCH_SSL_VERIFY |
| 77 | value: "true" |
| 78 | # Option to configure elasticsearch plugin with tls |
| 79 | # ================================================================ |
| 80 | - name: FLUENT_ELASTICSEARCH_SSL_VERSION |
| 81 | value: "TLSv1_2" |
| 82 | # X-Pack Authentication |
| 83 | # ===================== |
| 84 | - name: FLUENT_ELASTICSEARCH_USER |
| 85 | value: "elastic" |
| 86 | - name: FLUENT_ELASTICSEARCH_PASSWORD |
| 87 | value: "secret" |
| 88 | # Logz.io Authentication |
| 89 | # ====================== |
| 90 | - name: LOGZIO_TOKEN |
| 91 | value: "ThisIsASuperLongToken" |
| 92 | - name: LOGZIO_LOGTYPE |
| 93 | value: "kubernetes" |
| 94 | - name: SSL_CERT_DIR |
| 95 | value: /home/fluent/ca |
| 96 | - name: SSL_CERT_FILE |
| 97 | value: /home/fluent/ca/ca.crt |
| 98 | resources: |
| 99 | limits: |
| 100 | memory: 200Mi |
| 101 | requests: |
| 102 | cpu: 100m |
| 103 | memory: 200Mi |
| 104 | volumeMounts: |
| 105 | - name: varlog |
| 106 | mountPath: /var/log |
| 107 | - name: dockercontainerlogdirectory |
| 108 | mountPath: /var/lib/docker/containers |
| 109 | readOnly: true |
| 110 | - name: fluentd-ca-cert |
| 111 | mountPath: /home/fluent/ca/ca.crt |
| 112 | subPath: ca.crt |
| 113 | readOnly: true |
| 114 | terminationGracePeriodSeconds: 30 |
| 115 | volumes: |
| 116 | - name: varlog |
| 117 | hostPath: |
| 118 | path: /var/log |
| 119 | - name: dockercontainerlogdirectory |
| 120 | hostPath: |
| 121 | path: /var/lib/docker/containers |
| 122 | - name: fluentd-ca-cert |
| 123 | hostPath: |
| 124 | # Ensure the file directory is created. |
| 125 | path: /var/elasticsearch/config/certs/ca |
| 126 | type: DirectoryOrCreate |