Fix nats-bootstrap: run from /tmp so the nats CLI works under readOnlyRootFS #311
Reference in New Issue
Block a user
Delete Branch "benvin/logging-deploy-fixes-3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Final-mile bringup: after #301/#306/#308 the auth chain was fixed and logs flowed, but the
nats-bootstrapPostSync hook failed with:The nats CLI stats its working directory when loading response-validation schemas. Under the Job's
readOnlyRootFilesystem: true+runAsUser: 1000, the nats-box image's default WORKDIR isn't accessible to uid 1000, so everynats stream/consumercall errored. (A throwaway pod using default securityContext worked, which is why manual stream creation succeeded.)Consequence: the PostSync hook never completes →
logging-loggingstays OutOfSync. TheLOGSstream + consumers persist in JetStream once created, so log flow is unaffected — but GitOps convergence is blocked and the hook would keep retrying.What
Set
workingDir: /tmpon the bootstrap container (the writable emptyDir already mounted forHOME). The nats CLI can then stat/operate normally.Verified on the live cluster: a nats-box pod with the Job's exact restrictive securityContext +
workingDir: /tmprunsnats stream info LOGScleanly (fails without it).Note (separate, pre-existing)
There is also a first-deploy ordering deadlock: the
nats-bootstrapPostSync hook runs only after the Sync-phase resources are healthy, but the vector consumer Deployments can't become healthy until the hook creates theLOGSstream. On this deploy I broke the deadlock by creating the stream/consumers manually (idempotent with the Job); the stream now persists so it won't recur on normal re-syncs, but a fresh cluster / PVC loss would hit it again. A durable fix (sync-waves so bootstrap runs after NATS but before the consumers) is worth a follow-up — flagged, not included here to keep this fix minimal.https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv