Skip to content

v2: RabbitMQ restarts again — Erlang cookie 0600 before start - #133

Merged
MIERAI merged 1 commit into
mainfrom
m6-rabbitmq-cookie
Nov 23, 2026
Merged

MIERAI merged 1 commit into
mainfrom
m6-rabbitmq-cookie

Conversation

@MIERAI

@MIERAI MIERAI commented Nov 23, 2026

Copy link
Copy Markdown
Owner

The first restart of rabbitmq-0 (the pod-template change in #132) crash-loops: Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only. kubelet's fsGroup pass over the volume made the cookie (created at the first start) group-readable. A latent defect: any restart of the broker (node reboot, eviction) would have hit it.

Fix: fsGroupChangePolicy: OnRootMismatch (skip the pass when the volume root already has the group) and an init container (same image, already on the node) that chmods the cookie to 0600 if it exists. Lab only (v2 is excluded on the laptop). v2-lab is down for messaging until this syncs; the outboxes keep every message.

🤖 Generated with Claude Code

… (fsGroup made it group-readable)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Rendered diff (as Argo CD renders: kustomize / Helm, against origin/main)

v2-lab (+22 / -0)
@@ -831,8 +831,30 @@
         - mountPath: /etc/rabbitmq/conf.d/20-lab.conf
           name: config
           subPath: 20-lab.conf
+      initContainers:
+      - command:
+        - sh
+        - -c
+        - '[ ! -f /var/lib/rabbitmq/.erlang.cookie ] || chmod 600 /var/lib/rabbitmq/.erlang.cookie'
+        image: mirror.gcr.io/library/rabbitmq:3.13.7-management
+        name: cookie
+        resources:
+          limits:
+            memory: 64Mi
+          requests:
+            cpu: 10m
+            memory: 16Mi
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+        volumeMounts:
+        - mountPath: /var/lib/rabbitmq
+          name: data
       securityContext:
         fsGroup: 999
+        fsGroupChangePolicy: OnRootMismatch
         runAsGroup: 999
         runAsNonRoot: true
         runAsUser: 999

@MIERAI
MIERAI merged commit fa3d884 into main Nov 23, 2026
2 checks passed
@MIERAI
MIERAI deleted the m6-rabbitmq-cookie branch November 23, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant