Files
allmende/k8s/base/statefulset.yaml
T
nilsandClaude Sonnet 5.5 dbd95bb8ef run: --no-login-link keeps the sign-in link out of the terminal
The link holds the admin token. Where the terminal is a log (containers) it
would end up in log storage; the notice then only says where the token file
is. The Kubernetes manifest uses it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 11:56:29 +01:00

119 lines
3.8 KiB
YAML

# One node, with its keys and database on a volume. Keep it at one replica: a
# second pod would be a second node with its own identity, not a copy.
#
# The identity is created by hand, once, because it shows a recovery phrase
# that must never end up in a log. Until you do, the pod waits:
# kubectl -n allmende exec -it allmende-0 -- allmende init
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: allmende
spec:
serviceName: allmende-p2p
replicas: 1
selector:
matchLabels:
app: allmende
template:
metadata:
labels:
app: allmende
spec:
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 30
containers:
- name: allmende
image: allmende
imagePullPolicy: IfNotPresent
# Wait for 'allmende init' (it writes admin.token last), then run as a
# bootstrap node: --public serves the DHT and relays for nodes behind
# a NAT, --announce names the address the router forwards.
command: ["/bin/sh", "-c"]
args:
- |
until [ -f /data/admin.token ]; do
echo "not set up yet: run kubectl -n allmende exec -it allmende-0 -- allmende init"
sleep 10
done
exec allmende run \
--public \
--no-default-bootstrap \
--no-mdns \
--no-login-link \
--http 0.0.0.0:8080 \
--listen /ip4/0.0.0.0/tcp/4001 \
--listen /ip4/0.0.0.0/udp/4001/quic-v1 \
--announce "/dns4/${PUBLIC_HOST}/tcp/${PUBLIC_PORT}" \
--announce "/dns4/${PUBLIC_HOST}/udp/${PUBLIC_PORT}/quic-v1"
envFrom:
- configMapRef:
name: allmende-config
env:
- name: ALLMENDE_DATA
value: /data
ports:
- name: p2p-tcp
containerPort: 4001
protocol: TCP
- name: p2p-quic
containerPort: 4001
protocol: UDP
- name: http
containerPort: 8080
protocol: TCP
# Ready once the node answers; before 'init' it never does, which keeps
# a half-set-up node out of the Services without restarting it.
readinessProbe:
httpGet:
path: /api/v1/status
port: http
periodSeconds: 10
# Only judge it dead after the first start succeeded (the wait for
# 'init' may take as long as you need).
startupProbe:
httpGet:
path: /api/v1/status
port: http
periodSeconds: 10
failureThreshold: 360
livenessProbe:
httpGet:
path: /api/v1/status
port: http
periodSeconds: 30
failureThreshold: 3
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
volumeMounts:
- name: data
mountPath: /data
- name: tmp # the root file system is read-only; SQLite wants a scratch place
mountPath: /tmp
volumes:
- name: tmp
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
# storageClassName: your-class # the cluster default is used otherwise
resources:
requests:
storage: 1Gi