-
Notifications
You must be signed in to change notification settings - Fork 21
/
ta-k8s-logs.yaml
129 lines (125 loc) · 2.82 KB
/
ta-k8s-logs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: ta-k8s-logs
name: ta-k8s-logs
imagePullSecrets:
- name: <yourdockerhubsecret>
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: ta-k8s-logs
rules:
- apiGroups: ["", "apps","batch","extensions"]
resources:
- cronjobs
- componentstatuses
- configmaps
- controllerrevisions
- daemonsets
- deployments
- jobs
- replicasets
- replicationcontrollers
- resourcequotas
- scheduledjobs
- statefulsets
- namespaces
- nodes
- services
- secrets
- serviceaccounts
- endpoints
- pods
verbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
labels:
app: ta-k8s-logs
name: ta-k8s-logs
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ta-k8s-logs
subjects:
- kind: ServiceAccount
name: ta-k8s-logs
namespace: default
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: ta-k8s-logs
labels:
app: ta-k8s-logs
name: ta-k8s-logs
spec:
updateStrategy:
type: RollingUpdate
template:
metadata:
name: ta-k8s-logs
labels:
daemon: ta-k8s-logs
spec:
serviceAccountName: ta-k8s-logs
tolerations:
- operator: "Exists"
effect: "NoSchedule"
containers:
- name: ta-k8s-logs
image: splunk/universalforwarder:7.0.3-monitor-k8s-logs
imagePullPolicy: Always
env:
- name: SPLUNK_FORWARD_SERVER
value: <splunk_host>:9997
- name: SPLUNK_START_ARGS
value: --accept-license --answer-yes
- name: SPLUNK_USER
value: root
resources:
limits:
cpu: 1
memory: 200Mi
requests:
cpu: 100m
memory: 200Mi
volumeMounts:
- name: varlog
mountPath: /var/log
readOnly: true
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
- name: dockersock
mountPath: /var/run/docker.sock
readOnly: true
#- name: splunk-uf-etc
# mountPath: /opt/splunk/etc
#- name: splunk-uf-var
# mountPath: /opt/splunk/var
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
- name: dockersock
hostPath:
path: /var/run/docker.sock
#- name: splunk-uf-etc
# emptyDir: {}
# #hostPath:
# # path: /var/lib/splunk-uf-etc
#- name: splunk-uf-var
# emptyDir: {}
# #hostPath:
# # path: /var/lib/splunk-uf-var