...
1apiVersion: apps/v1
2kind: DaemonSet
3metadata:
4 name: fluentd-gcp-{{ fluentd_gcp_yaml_version }}
5 namespace: kube-system
6 labels:
7 k8s-app: fluentd-gcp
8 kubernetes.io/cluster-service: "true"
9 addonmanager.kubernetes.io/mode: Reconcile
10 version: {{ fluentd_gcp_yaml_version }}
11spec:
12 selector:
13 matchLabels:
14 k8s-app: fluentd-gcp
15 version: {{ fluentd_gcp_yaml_version }}
16 updateStrategy:
17 type: RollingUpdate
18 template:
19 metadata:
20 labels:
21 k8s-app: fluentd-gcp
22 kubernetes.io/cluster-service: "true"
23 version: {{ fluentd_gcp_yaml_version }}
24 spec:
25 priorityClassName: system-node-critical
26 serviceAccountName: fluentd-gcp
27 dnsPolicy: Default
28 hostNetwork: true
29 containers:
30 - name: fluentd-gcp
31 image: gcr.io/stackdriver-agents/stackdriver-logging-agent:{{ fluentd_gcp_version }}
32 volumeMounts:
33 - name: varlog
34 mountPath: /var/log
35 - name: varlibdockercontainers
36 mountPath: /var/lib/docker/containers
37 readOnly: true
38 - name: config-volume
39 mountPath: /etc/google-fluentd/config.d
40 env:
41 - name: NODE_NAME
42 valueFrom:
43 fieldRef:
44 apiVersion: v1
45 fieldPath: spec.nodeName
46 - name: STACKDRIVER_METADATA_AGENT_URL
47 value: http://$(NODE_NAME):8799
48 # Liveness probe is aimed to help in situarions where fluentd
49 # silently hangs for no apparent reasons until manual restart.
50 # The idea of this probe is that if fluentd is not queueing or
51 # flushing chunks for 5 minutes, something is not right. If
52 # you want to change the fluentd configuration, reducing amount of
53 # logs fluentd collects, consider changing the threshold or turning
54 # liveness probe off completely.
55 livenessProbe:
56 initialDelaySeconds: 600
57 periodSeconds: 60
58 exec:
59 command:
60 - '/bin/sh'
61 - '-c'
62 - >
63 LIVENESS_THRESHOLD_SECONDS=${LIVENESS_THRESHOLD_SECONDS:-300};
64 STUCK_THRESHOLD_SECONDS=${STUCK_THRESHOLD_SECONDS:-900};
65 if [ ! -e /var/log/fluentd-buffers ];
66 then
67 exit 1;
68 fi;
69 touch -d "${STUCK_THRESHOLD_SECONDS} seconds ago" /tmp/marker-stuck;
70 if [ -z "$(find /var/log/fluentd-buffers -type d -newer /tmp/marker-stuck -print -quit)" ];
71 then
72 rm -rf /var/log/fluentd-buffers;
73 exit 1;
74 fi;
75 touch -d "${LIVENESS_THRESHOLD_SECONDS} seconds ago" /tmp/marker-liveness;
76 if [ -z "$(find /var/log/fluentd-buffers -type d -newer /tmp/marker-liveness -print -quit)" ];
77 then
78 exit 1;
79 fi;
80 # BEGIN_PROMETHEUS_TO_SD
81 - name: prometheus-to-sd-exporter
82 image: gke.gcr.io/prometheus-to-sd:v0.11.1-gke.1
83 command:
84 - /monitor
85 - --stackdriver-prefix={{ prometheus_to_sd_prefix }}/addons
86 - --api-override={{ prometheus_to_sd_endpoint }}
87 - --source=fluentd:http://localhost:24231?whitelisted=stackdriver_successful_requests_count,stackdriver_failed_requests_count,stackdriver_ingested_entries_count,stackdriver_dropped_entries_count
88 - --pod-id=$(POD_NAME)
89 - --namespace-id=$(POD_NAMESPACE)
90 env:
91 - name: POD_NAME
92 valueFrom:
93 fieldRef:
94 fieldPath: metadata.name
95 - name: POD_NAMESPACE
96 valueFrom:
97 fieldRef:
98 fieldPath: metadata.namespace
99 # END_PROMETHEUS_TO_SD
100 nodeSelector:
101 kubernetes.io/os: linux
102 terminationGracePeriodSeconds: 60
103 tolerations:
104 - operator: "Exists"
105 effect: "NoExecute"
106 - operator: "Exists"
107 effect: "NoSchedule"
108 volumes:
109 - name: varlog
110 hostPath:
111 path: /var/log
112 - name: varlibdockercontainers
113 hostPath:
114 path: /var/lib/docker/containers
115 - name: config-volume
116 configMap:
117 name: {{ fluentd_gcp_configmap_name }}-v1.2.5
View as plain text