-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathflp-daemonset.yml
165 lines (165 loc) · 3.52 KB
/
flp-daemonset.yml
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
# Example deployment for manual testing with flp
# It requires loki to be installed
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: netobserv-ebpf-agent
labels:
k8s-app: netobserv-ebpf-agent
spec:
selector:
matchLabels:
k8s-app: netobserv-ebpf-agent
template:
metadata:
labels:
k8s-app: netobserv-ebpf-agent
spec:
serviceAccountName: netobserv-account
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: netobserv-ebpf-agent
image: quay.io/netobserv/netobserv-ebpf-agent:main
imagePullPolicy: Always
securityContext:
privileged: true
runAsUser: 0
env:
- name: FLOWS_TARGET_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: FLOWS_TARGET_PORT
value: "9999"
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: flp
labels:
k8s-app: flp
spec:
selector:
matchLabels:
k8s-app: flp
template:
metadata:
labels:
k8s-app: flp
spec:
serviceAccountName: netobserv-account
containers:
- name: packet-counter
image: quay.io/netobserv/flowlogs-pipeline:main
imagePullPolicy: Always
ports:
- containerPort: 9999
hostPort: 9999
args:
- --config=/etc/flp/config.yaml
volumeMounts:
- mountPath: /etc/flp
name: config-volume
volumes:
- name: config-volume
configMap:
name: flp-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: flp-config
data:
config.yaml: |
log-level: debug
pipeline:
- name: ingest
- name: decode
follows: ingest
- name: enrich
follows: decode
- name: loki
follows: enrich
parameters:
- name: ingest
ingest:
type: grpc
grpc:
port: 9999
- name: decode
decode:
type: protobuf
- name: enrich
transform:
type: network
network:
rules:
- input: SrcAddr
output: SrcK8S
type: "add_kubernetes"
- input: DstAddr
output: DstK8S
type: "add_kubernetes"
- name: loki
write:
type: loki
loki:
type: loki
staticLabels:
app: netobserv-flowcollector
labels:
- "SrcK8S_Namespace"
- "SrcK8S_OwnerName"
- "DstK8S_Namespace"
- "DstK8S_OwnerName"
- "FlowDirection"
url: http://loki:3100
timestampLabel: TimeFlowEndMs
timestampScale: 1ms
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: netobserv-account
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: netobserv
rules:
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- replicasets
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- configmaps
- namespaces
- services
- nodes
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: netobserv
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: netobserv
subjects:
- kind: ServiceAccount
name: netobserv-account
namespace: default