mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-02-14 18:09:51 +00:00
* Clean kubeshark pinned bpf resources inside init container * Clean kubeshark pinned bpf resources inside init container * Update 09-worker-daemon-set.yaml * add IPC_LOCK capability to sniffer * add init container to mount bpf filesystem * add init container to mount bpf filesystem --------- Co-authored-by: Alon Girmonsky <1990761+alongir@users.noreply.github.com>
313 lines
12 KiB
YAML
313 lines
12 KiB
YAML
---
|
|
apiVersion: apps/v1
|
|
kind: DaemonSet
|
|
metadata:
|
|
labels:
|
|
app.kubeshark.co/app: worker
|
|
sidecar.istio.io/inject: "false"
|
|
{{- include "kubeshark.labels" . | nindent 4 }}
|
|
annotations:
|
|
{{- if .Values.tap.annotations }}
|
|
{{- toYaml .Values.tap.annotations | nindent 4 }}
|
|
{{- end }}
|
|
name: kubeshark-worker-daemon-set
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app.kubeshark.co/app: worker
|
|
{{- include "kubeshark.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubeshark.co/app: worker
|
|
{{- include "kubeshark.labels" . | nindent 8 }}
|
|
name: kubeshark-worker-daemon-set
|
|
namespace: kubeshark
|
|
spec:
|
|
initContainers:
|
|
- command:
|
|
- /bin/sh
|
|
- -c
|
|
- mkdir -p /sys/fs/bpf && mount | grep -q '/sys/fs/bpf' || mount -t bpf bpf /sys/fs/bpf
|
|
{{- if .Values.tap.docker.overrideTag.worker }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ .Values.tap.docker.overrideTag.worker }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{ else }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ not (eq .Values.tap.docker.tag "") | ternary .Values.tap.docker.tag (include "kubeshark.defaultVersion" .) }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{- end }}
|
|
imagePullPolicy: {{ .Values.tap.docker.imagePullPolicy }}
|
|
name: check-bpf
|
|
securityContext:
|
|
privileged: true
|
|
volumeMounts:
|
|
- mountPath: /sys
|
|
name: sys
|
|
mountPropagation: Bidirectional
|
|
- command:
|
|
- ./tracer
|
|
- -init-bpf
|
|
{{- if .Values.tap.docker.overrideTag.worker }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ .Values.tap.docker.overrideTag.worker }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{ else }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ not (eq .Values.tap.docker.tag "") | ternary .Values.tap.docker.tag (include "kubeshark.defaultVersion" .) }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{- end }}
|
|
imagePullPolicy: {{ .Values.tap.docker.imagePullPolicy }}
|
|
name: init-bpf
|
|
securityContext:
|
|
privileged: true
|
|
volumeMounts:
|
|
- mountPath: /sys
|
|
name: sys
|
|
containers:
|
|
- command:
|
|
- ./worker
|
|
- -i
|
|
- any
|
|
- -port
|
|
- '{{ .Values.tap.proxy.worker.srvPort }}'
|
|
- -metrics-port
|
|
- '{{ .Values.tap.metrics.port }}'
|
|
- -packet-capture
|
|
- '{{ .Values.tap.packetCapture }}'
|
|
- -loglevel
|
|
- '{{ .Values.logLevel | default "warning" }}'
|
|
{{- if .Values.tap.tls }}
|
|
- -unixsocket
|
|
{{- end }}
|
|
{{- if .Values.tap.serviceMesh }}
|
|
- -servicemesh
|
|
{{- end }}
|
|
- -procfs
|
|
- /hostproc
|
|
{{- if ne .Values.tap.packetCapture "ebpf" }}
|
|
- -disable-ebpf
|
|
{{- end }}
|
|
{{- if .Values.tap.resourceGuard.enabled }}
|
|
- -enable-resource-guard
|
|
{{- end }}
|
|
- -resolution-strategy
|
|
- '{{ .Values.tap.misc.resolutionStrategy }}'
|
|
- -staletimeout
|
|
- '{{ .Values.tap.misc.staleTimeoutSeconds }}'
|
|
{{- if .Values.tap.docker.overrideImage.worker }}
|
|
image: '{{ .Values.tap.docker.overrideImage.worker }}'
|
|
{{- else if .Values.tap.docker.overrideTag.worker }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ .Values.tap.docker.overrideTag.worker }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{ else }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ not (eq .Values.tap.docker.tag "") | ternary .Values.tap.docker.tag (include "kubeshark.defaultVersion" .) }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{- end }}
|
|
imagePullPolicy: {{ .Values.tap.docker.imagePullPolicy }}
|
|
{{- if .Values.tap.docker.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- range .Values.tap.docker.imagePullSecrets }}
|
|
- name: {{ . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
name: sniffer
|
|
ports:
|
|
- containerPort: {{ .Values.tap.metrics.port }}
|
|
protocol: TCP
|
|
name: metrics
|
|
env:
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: TCP_STREAM_CHANNEL_TIMEOUT_MS
|
|
value: '{{ .Values.tap.misc.tcpStreamChannelTimeoutMs }}'
|
|
- name: TCP_STREAM_CHANNEL_TIMEOUT_SHOW
|
|
value: '{{ .Values.tap.misc.tcpStreamChannelTimeoutShow }}'
|
|
- name: KUBESHARK_CLOUD_API_URL
|
|
value: 'https://api.kubeshark.co'
|
|
- name: PROFILING_ENABLED
|
|
value: '{{ .Values.tap.pprof.enabled }}'
|
|
- name: SENTRY_ENABLED
|
|
value: '{{ (include "sentry.enabled" .) }}'
|
|
- name: SENTRY_ENVIRONMENT
|
|
value: '{{ .Values.tap.sentry.environment }}'
|
|
resources:
|
|
limits:
|
|
{{ if ne (toString .Values.tap.resources.sniffer.limits.cpu) "0" }}
|
|
cpu: {{ .Values.tap.resources.sniffer.limits.cpu }}
|
|
{{ end }}
|
|
{{ if ne (toString .Values.tap.resources.sniffer.limits.memory) "0" }}
|
|
memory: {{ .Values.tap.resources.sniffer.limits.memory }}
|
|
{{ end }}
|
|
requests:
|
|
{{ if ne (toString .Values.tap.resources.sniffer.requests.cpu) "0" }}
|
|
cpu: {{ .Values.tap.resources.sniffer.requests.cpu }}
|
|
{{ end }}
|
|
{{ if ne (toString .Values.tap.resources.sniffer.requests.memory) "0" }}
|
|
memory: {{ .Values.tap.resources.sniffer.requests.memory }}
|
|
{{ end }}
|
|
securityContext:
|
|
capabilities:
|
|
add:
|
|
{{- range .Values.tap.capabilities.networkCapture }}
|
|
{{ print "- " . }}
|
|
{{- end }}
|
|
{{- if .Values.tap.serviceMesh }}
|
|
{{- range .Values.tap.capabilities.serviceMeshCapture }}
|
|
{{ print "- " . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
drop:
|
|
- ALL
|
|
readinessProbe:
|
|
periodSeconds: 1
|
|
failureThreshold: 3
|
|
successThreshold: 1
|
|
initialDelaySeconds: 5
|
|
tcpSocket:
|
|
port: {{ .Values.tap.proxy.worker.srvPort }}
|
|
livenessProbe:
|
|
periodSeconds: 1
|
|
failureThreshold: 3
|
|
successThreshold: 1
|
|
initialDelaySeconds: 5
|
|
tcpSocket:
|
|
port: {{ .Values.tap.proxy.worker.srvPort }}
|
|
volumeMounts:
|
|
- mountPath: /hostproc
|
|
name: proc
|
|
readOnly: true
|
|
- mountPath: /sys
|
|
name: sys
|
|
readOnly: true
|
|
- mountPath: /app/data
|
|
name: data
|
|
{{- if .Values.tap.tls }}
|
|
- command:
|
|
- ./tracer
|
|
- -procfs
|
|
- /hostproc
|
|
{{- if ne .Values.tap.packetCapture "ebpf" }}
|
|
- -disable-ebpf
|
|
{{- end }}
|
|
{{- if .Values.tap.disableTlsLog }}
|
|
- -disable-tls-log
|
|
{{- end }}
|
|
{{- if .Values.tap.pprof.enabled }}
|
|
- -port
|
|
- '{{ add .Values.tap.proxy.worker.srvPort 1 }}'
|
|
{{- end }}
|
|
# - -loglevel
|
|
# - '{{ .Values.logLevel | default "warning" }}'
|
|
{{- if .Values.tap.docker.overrideTag.worker }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ .Values.tap.docker.overrideTag.worker }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{ else }}
|
|
image: '{{ .Values.tap.docker.registry }}/worker:{{ not (eq .Values.tap.docker.tag "") | ternary .Values.tap.docker.tag (include "kubeshark.defaultVersion" .) }}{{ include "kubeshark.dockerTagDebugVersion" . }}'
|
|
{{- end }}
|
|
imagePullPolicy: {{ .Values.tap.docker.imagePullPolicy }}
|
|
{{- if .Values.tap.docker.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- range .Values.tap.docker.imagePullSecrets }}
|
|
- name: {{ . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
name: tracer
|
|
env:
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: PROFILING_ENABLED
|
|
value: '{{ .Values.tap.pprof.enabled }}'
|
|
- name: SENTRY_ENABLED
|
|
value: '{{ (include "sentry.enabled" .) }}'
|
|
- name: SENTRY_ENVIRONMENT
|
|
value: '{{ .Values.tap.sentry.environment }}'
|
|
resources:
|
|
limits:
|
|
{{ if ne (toString .Values.tap.resources.tracer.limits.cpu) "0" }}
|
|
cpu: {{ .Values.tap.resources.tracer.limits.cpu }}
|
|
{{ end }}
|
|
{{ if ne (toString .Values.tap.resources.tracer.limits.memory) "0" }}
|
|
memory: {{ .Values.tap.resources.tracer.limits.memory }}
|
|
{{ end }}
|
|
requests:
|
|
{{ if ne (toString .Values.tap.resources.tracer.requests.cpu) "0" }}
|
|
cpu: {{ .Values.tap.resources.tracer.requests.cpu }}
|
|
{{ end }}
|
|
{{ if ne (toString .Values.tap.resources.tracer.requests.memory) "0" }}
|
|
memory: {{ .Values.tap.resources.tracer.requests.memory }}
|
|
{{ end }}
|
|
securityContext:
|
|
capabilities:
|
|
add:
|
|
{{- range .Values.tap.capabilities.ebpfCapture }}
|
|
{{ print "- " . }}
|
|
{{- end }}
|
|
{{- range .Values.tap.capabilities.networkCapture }}
|
|
{{ print "- " . }}
|
|
{{- end }}
|
|
drop:
|
|
- ALL
|
|
volumeMounts:
|
|
- mountPath: /hostproc
|
|
name: proc
|
|
readOnly: true
|
|
- mountPath: /sys
|
|
name: sys
|
|
readOnly: true
|
|
- mountPath: /app/data
|
|
name: data
|
|
- mountPath: /etc/os-release
|
|
name: os-release
|
|
readOnly: true
|
|
- mountPath: /hostroot
|
|
mountPropagation: HostToContainer
|
|
name: root
|
|
readOnly: true
|
|
{{- end }}
|
|
dnsPolicy: ClusterFirstWithHostNet
|
|
hostNetwork: true
|
|
serviceAccountName: {{ include "kubeshark.serviceAccountName" . }}
|
|
terminationGracePeriodSeconds: 0
|
|
tolerations:
|
|
- effect: NoExecute
|
|
operator: Exists
|
|
{{- if not .Values.tap.ignoreTainted }}
|
|
- effect: NoSchedule
|
|
operator: Exists
|
|
{{- end }}
|
|
{{- if gt (len .Values.tap.nodeSelectorTerms) 0}}
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
{{- toYaml .Values.tap.nodeSelectorTerms | nindent 12 }}
|
|
{{- end }}
|
|
volumes:
|
|
- hostPath:
|
|
path: /proc
|
|
name: proc
|
|
- hostPath:
|
|
path: /sys
|
|
name: sys
|
|
- name: lib-modules
|
|
hostPath:
|
|
path: /lib/modules
|
|
- hostPath:
|
|
path: /etc/os-release
|
|
name: os-release
|
|
- hostPath:
|
|
path: /
|
|
name: root
|
|
- name: data
|
|
{{- if .Values.tap.persistentStorage }}
|
|
persistentVolumeClaim:
|
|
claimName: kubeshark-persistent-volume-claim
|
|
{{- else }}
|
|
emptyDir:
|
|
sizeLimit: {{ .Values.tap.storageLimit }}
|
|
{{- end }}
|