...
1# Template job config for running the log exporter on the cluster as a daemonset.
2# Creates everything within 'logexporter' namespace.
3#
4# Note: Since daemonsets have "AlwaysRestart" policy for pods, we provide a long
5# sleep-duration (24 hr) to the logexporter pods so they don't finish the work and
6# get restarted while some pods are still running. So it is your duty to detect
7# the work has been done (or use some timeout) and delete the daemonset yourself.
8
9apiVersion: v1
10kind: Namespace
11metadata:
12 name: {{.LogexporterNamespace}}
13---
14apiVersion: v1
15kind: Secret
16metadata:
17 name: google-service-account
18 namespace: {{.LogexporterNamespace}}
19type: Opaque
20data:
21 service-account.json: {{.ServiceAccountCredentials}}
22---
23apiVersion: apps/v1
24kind: DaemonSet
25metadata:
26 name: logexporter
27 namespace: {{.LogexporterNamespace}}
28spec:
29 selector:
30 matchLabels:
31 app: logexporter
32 template:
33 metadata:
34 labels:
35 app: logexporter
36 spec:
37 containers:
38 - name: logexporter-test
39 image: gcr.io/k8s-testimages/logexporter:v20200401-c3269f485
40 env:
41 - name: NODE_NAME
42 valueFrom:
43 fieldRef:
44 fieldPath: spec.nodeName
45 command:
46 - logexporter
47 - --node-name=$(NODE_NAME)
48 - --cloud-provider={{.CloudProvider}}
49 - --gcs-path={{.GCSPath}}
50 - --gcloud-auth-file-path=/etc/service-account/service-account.json
51 - --enable-hollow-node-logs={{.EnableHollowNodeLogs}}
52 - --dump-systemd-journal={{.DumpSystemdJournal}}
53 - --extra-log-files={{.ExtraLogFiles}}
54 - --extra-systemd-services={{.ExtraSystemdServices}}
55 - --sleep-duration=24h
56 volumeMounts:
57 - mountPath: /etc/service-account
58 name: service
59 readOnly: true
60 - mountPath: /var/log
61 name: varlog
62 readOnly: true
63 - mountPath: /workspace/etc
64 name: hostetc
65 readOnly: true
66 resources:
67 requests:
68 cpu: 10m
69 memory: 10Mi
70 nodeSelector:
71 {{.NodeSelector}}
72 volumes:
73 - name: service
74 secret:
75 secretName: google-service-account
76 - name: varlog
77 hostPath:
78 path: /var/log
79 - name: hostetc
80 hostPath:
81 path: /etc
View as plain text