Kubernetes container log source
Bower.Source.Kubernetes collects allow-listed security telemetry from container logs
under /var/log/pods on Linux nodes with minimal pod metadata enrichment.
Selection and least privilege
- No cluster-wide default collection:
KubernetesLogSourceOptionsrequires explicit allow-listedNamespaces(DNS-1123 names, max 32) and explicitLabelSelectors(key=value, max 16). - No pod annotation auto-discovery: pods cannot opt themselves into collection via annotations. Only operator-approved namespaces and label selectors are queried.
- Namespaced RBAC only: grant the DaemonSet
ServiceAccounta namespacedRole(get,listonpods) strictly in each approved namespace — seedeploy/kubernetes/daemonset.yaml. Never use aClusterRoleor secret/exec permissions. - Minimal metadata: attaches
k8s.namespace,k8s.pod,k8s.container,k8s.stream, and only pod label keys explicitly named inAllowedMetadataLabels. All labels pass through Bower's Privacy & Secret Protection Engine before persistence.
CRI parsing, rotation and checkpoints
- Reuses
Bower.Source.File.FileTailReaderfor symlink-safe, bounded file reads with rename and copytruncate rotation detection. - Parses standard CRI container log lines (
<RFC3339 timestamp> <stdout|stderr> <P|F> <message>), joining partial (P) fragments up toMaxPartialBytes(default 64 KiB) until the final (F) line arrives. Malformed and oversized lines are counted and skipped safely. - Only validated Bower
SecurityEventEnvelopeJSON records are forwarded; unrecognised unstructured stdout noise is dropped at the source. - Checkpoints (
FileTailCursor) are persisted inISourceCursorStoreunderk8s:<namespace>/<podUid>/<container>strictly after caller acknowledgement, surviving restarts and log rotation without loss or duplicates. DeterministicEventIdvalues derived from(podUid, container, fileFingerprint, startOffset)deduplicate replays.