Fix garage container command and drop postStart layout hook

The dxflrs/garage image ships as a single static binary with no
ENTRYPOINT and no shell, so `args: [server]` alone was exec'd as the
command (crash loop) and the shell-based postStart layout-bootstrap
hook could never run. Set command: [/garage] explicitly, and replace
the automated hook with documented one-time `kubectl exec` steps.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ZA4cJygj4VPCYVms4TDrH
This commit is contained in:
sha
2026-09-13 13:10:23 +03:00
co-authored by Claude Sonnet 5
parent 52783d47a8
commit 095860ccd0
3 changed files with 14 additions and 34 deletions
+10 -6
View File
@@ -1,16 +1,20 @@
Garage {{ .Chart.AppVersion }} has been deployed. Garage {{ .Chart.AppVersion }} has been deployed.
S3 API: http://{{ include "garage.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.s3ApiPort }} S3 API: http://{{ include "garage.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.s3ApiPort }}
Admin API: http://{{ include "garage.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.adminPort }} Admin API: http://{{ include "garage.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.adminPort }}
{{- if .Values.garage.web.enabled }} {{- if .Values.garage.web.enabled }}
Web: http://{{ include "garage.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.s3WebPort }} Web: http://{{ include "garage.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.s3WebPort }}
{{- end }} {{- end }}
On first install, the pod's postStart hook assigns and applies a single-node REQUIRED one-time setup (Garage does not accept S3/admin traffic until a
layout automatically. Check with: layout is assigned and applied):
kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage status
Create a bucket and access key with: kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage status
NODE_ID=$(kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage node id -q | cut -d@ -f1)
kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage layout assign -z {{ .Values.garage.zone }} -c {{ .Values.garage.capacity }} "$NODE_ID"
kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage layout apply --version 1
Then create a bucket and access key:
kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage bucket create my-bucket kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage bucket create my-bucket
kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage key create my-key kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage key create my-key
kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage bucket allow --read --write --key my-key my-bucket kubectl -n {{ .Release.Namespace }} exec deploy/{{ include "garage.fullname" . }} -- /garage bucket allow --read --write --key my-key my-bucket
+2 -22
View File
@@ -24,6 +24,8 @@ spec:
- name: garage - name: garage
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /garage
args: args:
- server - server
env: env:
@@ -51,28 +53,6 @@ spec:
mountPath: /var/lib/garage/data mountPath: /var/lib/garage/data
- name: meta - name: meta
mountPath: /var/lib/garage/meta mountPath: /var/lib/garage/meta
{{- if .Values.layoutJob.enabled }}
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- |
NODE_ID=""
for i in $(seq 1 60); do
NODE_ID=$(/garage node id -q 2>/dev/null | cut -d@ -f1)
[ -n "$NODE_ID" ] && break
sleep 2
done
[ -z "$NODE_ID" ] && exit 0
if /garage layout show 2>/dev/null | grep -q "$NODE_ID"; then
exit 0
fi
/garage layout assign -z {{ .Values.garage.zone }} -c {{ .Values.garage.capacity }} "$NODE_ID"
VERSION=$(/garage layout show 2>/dev/null | grep -o 'version [0-9]*' | tail -1 | awk '{print $2+1}')
/garage layout apply --version "${VERSION:-1}" || true
{{- end }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: s3-api port: s3-api
+2 -6
View File
@@ -17,7 +17,8 @@ garage:
replicationFactor: 1 replicationFactor: 1
consistencyMode: consistent consistencyMode: consistent
dbEngine: sqlite dbEngine: sqlite
# Zone/capacity used by the layout job to bootstrap a single-node cluster. # Recommended zone/capacity for the one-time manual layout bootstrap
# (see NOTES.txt) - `garage layout assign -z <zone> -c <capacity> <node-id>`.
zone: dc1 zone: dc1
capacity: 100G capacity: 100G
rpcBindAddr: "[::]:3901" rpcBindAddr: "[::]:3901"
@@ -91,11 +92,6 @@ ingress:
hosts: [] hosts: []
tls: [] tls: []
# One-shot Helm hook Job that assigns and applies a single-node layout on
# first install. Safe to re-run; it exits early once a layout already exists.
layoutJob:
enabled: true
resources: resources:
requests: requests:
cpu: 100m cpu: 100m