controlplane: enable kube-apiserver audit logging (audit F1) #46

Merged
sirius merged 1 commit from controlplane/apiserver-audit into master 2026-11-27 05:20:37 +00:00
Owner

Audit F1 of the 2026-11-27 cluster netsec audit: the apiserver had no audit config at all.

Live on siriussec now — --audit-policy-file + --audit-log-path (JSON, 100 MiB x 48, maxage 7d, compressed), policy at /etc/kubernetes/audit/audit-policy.yaml, log at /var/log/kubernetes/audit/audit.log.

Measured volume: first cut (RequestResponse for every secret verb) cost 22.8 GB/day because flux lists all secrets (1.9 MiB/list) and rewrites helm release blobs; list/watch/update of secrets are Metadata now, total ~2.5 GB/day.

Proof in the trail: get forgejo/pg-superuser 404 (the card's literal command — the secret is actually forgejo-pg-app), get forgejo/forgejo-pg-app 200 with responseObject, create roles/audit-trail-probe (dryRun) 201, pods/exec with the full command line.

The manifest is kubeadm-owned and NOT reconciled by Flux, so kubeadm upgrade silently drops it; infrastructure/controlplane/audit/install-audit.sh --check detects that and re-apply is idempotent (verified byte-identical to the live manifest).

No authorization mode, admission plugin or apiserver cert touched. Do not add logrotate for the audit path: the apiserver owns the fd and does its own rotation.

Audit F1 of the 2026-11-27 cluster netsec audit: the apiserver had no audit config at all. Live on siriussec now — `--audit-policy-file` + `--audit-log-path` (JSON, 100 MiB x 48, maxage 7d, compressed), policy at `/etc/kubernetes/audit/audit-policy.yaml`, log at `/var/log/kubernetes/audit/audit.log`. Measured volume: first cut (RequestResponse for every secret verb) cost 22.8 GB/day because flux lists all secrets (1.9 MiB/list) and rewrites helm release blobs; list/watch/update of secrets are Metadata now, total ~2.5 GB/day. Proof in the trail: `get forgejo/pg-superuser` 404 (the card's literal command — the secret is actually `forgejo-pg-app`), `get forgejo/forgejo-pg-app` 200 with responseObject, `create roles/audit-trail-probe` (dryRun) 201, `pods/exec` with the full command line. The manifest is kubeadm-owned and NOT reconciled by Flux, so `kubeadm upgrade` silently drops it; `infrastructure/controlplane/audit/install-audit.sh --check` detects that and re-apply is idempotent (verified byte-identical to the live manifest). No authorization mode, admission plugin or apiserver cert touched. Do not add logrotate for the audit path: the apiserver owns the fd and does its own rotation.
The apiserver ran with no --audit-* flags at all: secret reads, pods/exec,
RBAC writes and serviceaccounts/token minting left no record anywhere.

- /etc/kubernetes/audit/audit-policy.yaml: RequestResponse for secrets
  get/write, pods/exec|attach|portforward, serviceaccounts/token, rbac.*,
  certificates.*, impersonate; Metadata for list/watch/update of secrets and
  for everything else (that split is what keeps 22.8 GB/day down to 2.5).
- static-pod flags: --audit-policy-file, --audit-log-path (JSON, 100 MiB x 48,
  maxage 7, compressed) + hostPath mounts for the policy dir and the log dir.
- install-audit.sh: idempotent, byte-identical re-application after a
  kubeadm upgrade silently regenerates the manifest (Flux does not own it).
- docs/kube-apiserver-audit-logging.md: design, measured volume, sensitivity
  (the log holds secret bodies), verify commands and rollback.
sirius merged commit 5646572eaf into master 2026-11-27 05:20:37 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/homek8s!46
No description provided.