Kubernetes
Every node has its own kernel, so the collector runs as a DaemonSet: one instance per node, each writing its own dataset to the node’s /var/lib/croft.
Load the image
Section titled “Load the image”The manifest uses croft-collector:dev, which no registry holds. Build it and load it into each node’s containerd. On a k3s cluster set up by the lab playbook:
docker build -f deploy/docker/Dockerfile -t croft-collector:dev .cd labs/k3s-clusteransible-playbook load-image.yml -e image=croft-collector:dev -KDeploy
Section titled “Deploy”croft deploy kubernetes # applies deploy/kubernetes/collector.yamlcroft deploy kubernetes --dry-run # prints the manifestkubectl -n croft get pods -o wideor kubectl apply -f deploy/kubernetes/collector.yaml.
The DaemonSet runs privileged with hostPID, tolerates every taint and mounts tracefs, the cgroup tree and /var/lib/croft. Its environment:
| Variable | Value | Effect |
|---|---|---|
WATCH_CGROUPS |
kubepods |
record every pod’s processes, GPU or not |
CROFT_METRICS_ADDR |
0.0.0.0:9464 |
serve the latest poll per container at /metrics, for croft scale |
DATASET_PATH |
/data/croft-dataset.jsonl |
the node’s /var/lib/croft |
Configuration lists the others.
Upgrade
Section titled “Upgrade”Load the new image, then restart the pods so they pick it up:
kubectl -n croft rollout restart ds/croft-collectorPull the datasets
Section titled “Pull the datasets”With the lab’s Ansible inventory, collect.yml copies each agent’s segments from the last 24 hours, and its live file, into research/data/nodes/<node>/:
cd labs/k3s-clusteransible-playbook collect.yml # last 24 hoursansible-playbook collect.yml -e collect_hours=0 # every segment the agents keepThe server’s own directory is linked, not copied. croft stats research/data/nodes summarizes what arrived.