diff --git a/kubernetes/apps/monitoring/smartctl-exporter.yaml b/kubernetes/apps/monitoring/smartctl-exporter.yaml index d937dcb4..172b61af 100644 --- a/kubernetes/apps/monitoring/smartctl-exporter.yaml +++ b/kubernetes/apps/monitoring/smartctl-exporter.yaml @@ -75,6 +75,25 @@ spec: capabilities: drop: ["ALL"] add: ["SYS_ADMIN", "SYS_RAWIO"] + # The capabilities alone are not enough, and this was measured + # rather than assumed. With the default profile the exporter found + # all three drives and could open none of them: + # "Smartctl open device: /dev/nvme0 failed: Operation not + # permitted" + # EPERM is the default seccomp action for a syscall the profile + # does not list. Reading /proc/1/status in the running container + # separated the two candidates: CapEff was 0x220000, so SYS_ADMIN + # and SYS_RAWIO were both effective — while Seccomp was 2 with one + # filter loaded. The kubelet sets seccompDefault: true, so every + # pod that does not say otherwise gets RuntimeDefault. + # + # This is still narrower than `privileged: true`, which would also + # grant every capability, all devices and write access to /sys. + # Narrowing further would mean shipping a custom seccomp profile + # that allows exactly the ioctl smartctl needs — worth doing if + # this list of exceptions ever grows, not worth it for one pod. + seccompProfile: + type: Unconfined volumeMounts: - name: dev mountPath: /dev