-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtorrent.yaml
211 lines (203 loc) · 5.06 KB
/
torrent.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
apiVersion: v1
kind: Namespace
metadata:
name: logging
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: torrent
namespace: logging
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: torrent
namespace: logging
rules:
- apiGroups: [""]
resources:
- nodes
- nodes/proxy
- services
- endpoints
- pods
verbs: ["get", "list", "watch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: torrent
roleRef:
kind: ClusterRole
name: torrent
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: torrent
namespace: logging
---
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
namespace: logging
labels:
k8s-app: torrent-logging
data:
filebeat.yml: |-
filebeat.autodiscover:
providers:
- type: kubernetes
include_annotations: ['torrent/stream', 'torrent/module_name']
templates:
- condition:
equals:
kubernetes.annotations.torrent/stream: 'true'
config:
- type: docker
fields:
module_name: "${data.kubernetes.annotations.torrent/module_name}"
containers:
stream: all
ids:
- "${data.kubernetes.container.id}"
queue.mem:
events: 4096
flush.min_events: 512
flush.timeout: 5s
logging.level: info
logging.metrics.enabled: true
filebeat.config:
inputs:
# Mounted `filebeat-inputs` configmap:
path: ${path.config}/inputs.d/*.yml
# Reload inputs configs as they change:
reload.enabled: true
reload.period: 10s
modules:
path: ${path.config}/modules.d/*.yml
# Reload module configs as they change:
reload.enabled: true
reload.period: 10s
output.console:
enabled: true
---
apiVersion: v1
kind: ConfigMap
metadata:
name: torrent-input-tpl
namespace: logging
labels:
k8s-app: torrent-logging
data:
filebeat-input-log.tpl: |-
- type: log
enabled: true
harvester_buffer_size: 10485760
paths:
- {{ .logPath }}/{{ .logFiles }}
fields:
module_name: {{ .moduleName }}
log_type: {{ .logType }}
tail_files: true
max_bytes: 1048576
close_inactive: 1h
close_renamed: true
close_removed: true
close_eof: false
close_timeout: 3600
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: torrent-filebeat
namespace: logging
labels:
k8s-app: torrent-logging
spec:
selector:
matchLabels:
name: torrent-filebeat
template:
metadata:
labels:
name: torrent-filebeat
spec:
serviceAccountName: torrent
containers:
- name: torrent
image: rand01ph/torrent:v2.0
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 300m
memory: 300Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- name: docker-sock-volume
mountPath: /var/run/docker.sock
# mount for generate log inputs
- name: inputs
mountPath: /tmp
# torrent for filebeat input template
- name: torrent-input-tpl
mountPath: /tpl
- name: filebeat
image: elastic/filebeat:6.8.2
imagePullPolicy: IfNotPresent
args: [
"-c", "/etc/filebeat.yml",
"-e",
]
securityContext:
runAsUser: 0
# If using Red Hat OpenShift uncomment this:
#privileged: true
resources:
limits:
cpu: 300m
memory: 300Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- name: filebeat-config
mountPath: /etc/filebeat.yml
readOnly: true
subPath: filebeat.yml
- name: inputs
mountPath: /usr/share/filebeat/inputs.d
readOnly: true
- name: data
mountPath: /usr/share/filebeat/data
- name: root
mountPath: /host
readOnly: true
mountPropagation: HostToContainer
volumes:
- name: filebeat-config
configMap:
defaultMode: 0600
name: filebeat-config
# data folder stores a registry of read status for all files, so we don't send everything again on a Filebeat pod restart
- name: data
hostPath:
path: /var/lib/filebeat-data
type: DirectoryOrCreate
# use for collect emptyDir log
- name: root
hostPath:
path: /
# shared for input file
- name: inputs
emptyDir: {}
- name: docker-sock-volume
hostPath:
path: /var/run/docker.sock
type: File
- name: torrent-input-tpl
configMap:
name: torrent-input-tpl