blob: c40296638d0c4ea74ded534303ceb075cbf47359 [file] [log] [blame]
ktimoney90fcec92022-04-29 15:46:50 +01001apiVersion: v1
2kind: ServiceAccount
3metadata:
4 name: fluentd
5 namespace: kube-system
6---
7apiVersion: rbac.authorization.k8s.io/v1
8kind: ClusterRole
9metadata:
10 name: fluentd
11 namespace: kube-system
12rules:
13- apiGroups:
14 - ""
15 resources:
16 - pods
17 - namespaces
18 verbs:
19 - get
20 - list
21 - watch
22---
23kind: ClusterRoleBinding
24apiVersion: rbac.authorization.k8s.io/v1
25metadata:
26 name: fluentd
27roleRef:
28 kind: ClusterRole
29 name: fluentd
30 apiGroup: rbac.authorization.k8s.io
31subjects:
32- kind: ServiceAccount
33 name: fluentd
34 namespace: kube-system
35---
36apiVersion: apps/v1
37kind: DaemonSet
38metadata:
39 name: fluentd
40 namespace: kube-system
41 labels:
42 k8s-app: fluentd-logging
43 version: v1
44spec:
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