apiVersion: apps/v1 kind: DaemonSet metadata: name: hubble-flow-collector namespace: netsec labels: app.kubernetes.io/name: hubble-flow-collector app.kubernetes.io/part-of: netsec spec: selector: matchLabels: app.kubernetes.io/name: hubble-flow-collector updateStrategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 template: metadata: labels: app.kubernetes.io/name: hubble-flow-collector app.kubernetes.io/part-of: netsec spec: # Phase 1: siriussec only. It is the node that runs every public # workload and the one whose egress/extrusion signal matters; rpi and # the volatile linode node must not be load-bearing for this. Widening # is a one-line change once the consumer (the netsec sensor) needs it. nodeSelector: kubernetes.io/hostname: siriussec # Nothing here talks to the API server. automountServiceAccountToken: false terminationGracePeriodSeconds: 10 containers: - name: collector # Exactly the image the Cilium agent on this node runs: same hubble # binary, same protobuf, no version skew with the flow API. Never # :latest, never a different minor. image: quay.io/cilium/cilium:v1.20.1@sha256:ae9ea21f7427fe24bc6ea7247eb552157a1b0a431744045d3f641545ca71d11b imagePullPolicy: IfNotPresent command: ["/bin/sh", "/scripts/collect.sh"] # hubble.sock on the host is `srw-rw---- root root` (0660, root-owned), # so the container MUST run as uid 0 to connect to it. That is the only # reason for root here: the mount set is one read-only unix socket plus # one writable log directory, no capabilities, no API token, not # privileged. securityContext: runAsUser: 0 runAsGroup: 0 allowPrivilegeEscalation: false capabilities: drop: ["ALL"] seccompProfile: type: RuntimeDefault env: - name: DATA_DIR value: /data - name: SOCK value: /var/run/cilium/hubble.sock # 6 files x 150 MiB = 900 MiB ceiling, inside the 1 GiB spec cap; # MAX_TOTAL_BYTES is the second, independent bound. - name: MAX_FILE_BYTES value: "157286400" - name: MAX_FILES value: "6" - name: MAX_TOTAL_BYTES value: "1006632960" resources: # Honest and small: a `hubble observe --follow` client plus mawk at # ~20 kept events/s. Requests keep it off the top of the eviction # list on a node that has hit DiskPressure before; no CPU limit so # a burst cannot throttle the writer, a memory limit so a leak # cannot hurt etcd's neighbour. requests: cpu: 50m memory: 64Mi limits: memory: 192Mi volumeMounts: # SINGLE FILE, never /var/run/cilium: that directory also holds # cilium.sock, which is full datapath admin for the whole cluster. - name: hubble-sock mountPath: /var/run/cilium/hubble.sock readOnly: true - name: flow-log mountPath: /data - name: scripts mountPath: /scripts readOnly: true volumes: - name: hubble-sock hostPath: path: /var/run/cilium/hubble.sock type: Socket - name: flow-log hostPath: path: /var/log/netsec type: DirectoryOrCreate - name: scripts configMap: name: hubble-flow-collector-scripts defaultMode: 0555