ktimoney | 3570d5a | 2022-05-24 13:54:55 +0100 | [diff] [blame^] | 1 | # |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2022 Nordix Foundation. |
| 4 | # ================================================================================ |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # SPDX-License-Identifier: Apache-2.0 |
| 18 | # ============LICENSE_END========================================================= |
| 19 | # |
ktimoney | 90fcec9 | 2022-04-29 15:46:50 +0100 | [diff] [blame] | 20 | apiVersion: v1 |
| 21 | kind: ServiceAccount |
| 22 | metadata: |
| 23 | name: fluentd |
| 24 | namespace: kube-system |
| 25 | --- |
| 26 | apiVersion: rbac.authorization.k8s.io/v1 |
| 27 | kind: ClusterRole |
| 28 | metadata: |
| 29 | name: fluentd |
| 30 | namespace: kube-system |
| 31 | rules: |
| 32 | - apiGroups: |
| 33 | - "" |
| 34 | resources: |
| 35 | - pods |
| 36 | - namespaces |
| 37 | verbs: |
| 38 | - get |
| 39 | - list |
| 40 | - watch |
| 41 | --- |
| 42 | kind: ClusterRoleBinding |
| 43 | apiVersion: rbac.authorization.k8s.io/v1 |
| 44 | metadata: |
| 45 | name: fluentd |
| 46 | roleRef: |
| 47 | kind: ClusterRole |
| 48 | name: fluentd |
| 49 | apiGroup: rbac.authorization.k8s.io |
| 50 | subjects: |
| 51 | - kind: ServiceAccount |
| 52 | name: fluentd |
| 53 | namespace: kube-system |
| 54 | --- |
| 55 | apiVersion: apps/v1 |
| 56 | kind: DaemonSet |
| 57 | metadata: |
| 58 | name: fluentd |
| 59 | namespace: kube-system |
| 60 | labels: |
| 61 | k8s-app: fluentd-logging |
| 62 | version: v1 |
| 63 | spec: |
| 64 | selector: |
| 65 | matchLabels: |
| 66 | k8s-app: fluentd-logging |
| 67 | version: v1 |
| 68 | template: |
| 69 | metadata: |
| 70 | labels: |
| 71 | k8s-app: fluentd-logging |
| 72 | version: v1 |
| 73 | spec: |
| 74 | tolerations: |
| 75 | - key: node-role.kubernetes.io/master |
| 76 | effect: NoSchedule |
| 77 | containers: |
| 78 | - name: fluentd |
| 79 | image: fluent/fluentd-kubernetes-daemonset:v1-debian-elasticsearch |
| 80 | env: |
| 81 | - name: FLUENT_ELASTICSEARCH_HOST |
| 82 | value: "elasticsearch.logging" |
| 83 | - name: FLUENT_ELASTICSEARCH_PORT |
| 84 | value: "9200" |
| 85 | - name: FLUENT_ELASTICSEARCH_SCHEME |
| 86 | value: "https" |
| 87 | - name: FLUENTD_SYSTEMD_CONF |
| 88 | value: 'disable' |
| 89 | - name: K8S_NODE_NAME |
| 90 | value: 'docker-cluster' |
| 91 | #- name: FLUENT_CONTAINER_TAIL_PARSER_TYPE |
| 92 | #value: /^(?<time>.+) (?<stream>stdout|stderr) [^ ]* (?<log>.*)$/ |
| 93 | # Option to configure elasticsearch plugin with self signed certs |
| 94 | # ================================================================ |
| 95 | - name: FLUENT_ELASTICSEARCH_SSL_VERIFY |
| 96 | value: "true" |
| 97 | # Option to configure elasticsearch plugin with tls |
| 98 | # ================================================================ |
| 99 | - name: FLUENT_ELASTICSEARCH_SSL_VERSION |
| 100 | value: "TLSv1_2" |
| 101 | # X-Pack Authentication |
| 102 | # ===================== |
| 103 | - name: FLUENT_ELASTICSEARCH_USER |
| 104 | value: "elastic" |
| 105 | - name: FLUENT_ELASTICSEARCH_PASSWORD |
| 106 | value: "secret" |
| 107 | # Logz.io Authentication |
| 108 | # ====================== |
| 109 | - name: LOGZIO_TOKEN |
| 110 | value: "ThisIsASuperLongToken" |
| 111 | - name: LOGZIO_LOGTYPE |
| 112 | value: "kubernetes" |
| 113 | - name: SSL_CERT_DIR |
| 114 | value: /home/fluent/ca |
| 115 | - name: SSL_CERT_FILE |
| 116 | value: /home/fluent/ca/ca.crt |
| 117 | resources: |
| 118 | limits: |
| 119 | memory: 200Mi |
| 120 | requests: |
| 121 | cpu: 100m |
| 122 | memory: 200Mi |
| 123 | volumeMounts: |
| 124 | - name: varlog |
| 125 | mountPath: /var/log |
| 126 | - name: dockercontainerlogdirectory |
| 127 | mountPath: /var/lib/docker/containers |
| 128 | readOnly: true |
| 129 | - name: fluentd-ca-cert |
| 130 | mountPath: /home/fluent/ca/ca.crt |
| 131 | subPath: ca.crt |
| 132 | readOnly: true |
| 133 | terminationGracePeriodSeconds: 30 |
| 134 | volumes: |
| 135 | - name: varlog |
| 136 | hostPath: |
| 137 | path: /var/log |
| 138 | - name: dockercontainerlogdirectory |
| 139 | hostPath: |
| 140 | path: /var/lib/docker/containers |
| 141 | - name: fluentd-ca-cert |
| 142 | hostPath: |
| 143 | # Ensure the file directory is created. |
| 144 | path: /var/elasticsearch/config/certs/ca |
| 145 | type: DirectoryOrCreate |