StatefulSet requirement¶
workload.kind accepts one value:
The contract's closed set is ("statefulset",), and the CLI flag offers the
same single choice. The reason is that three things a node depends on come from
what a StatefulSet provides and a Deployment does not.
What the node gets from it¶
Stable ordinal names. Pods are dp-eu-west1-0, dp-eu-west1-1, in order.
Those names are the node labels, and the invitation minted at apply is bound to
each label. A pod that came back under a different name would find no code
addressed to it.
The manifest reads the label from the pod's own name:
- name: XRATU_NODE_LABEL
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: XRATU_ENROLLMENT_INVITATION_FILE
value: "/var/run/xratu/enrollment/${XRATU_NODE_LABEL}.token"
A durable volume per pod. Each replica gets its own claim from the volume claim template, mounted where the node keeps its identity:
volumeClaimTemplates:
- metadata:
name: cursor-state
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: "1Gi"
That volume holds the installation identity that makes a restart a continuation. See Durable runtime state.
Identity that survives scaling. With the retention policy set to Retain on
both delete and scale, a pod scaled away keeps its claim, and the same node
returns when it is scaled back.
How the three fit together¶
flowchart TB
SS["StatefulSet"] --> ON["Stable ordinal name<br/>dp-eu-west1-0"]
SS --> PV["Own volume<br/>retained on scale"]
ON --> NL["Node label"]
NL --> INV["Its own invitation"]
PV --> ID["Installation identity"]
INV --> ENR["Enrolment"]
ID --> ENR
ENR --> CONT["A restart is a continuation"]
Remove any one and continuity breaks: a random name finds no invitation, a shared or ephemeral volume loses the installation identity, and either one turns every restart into a new node.
The Service that comes with it¶
The bundle renders a headless Service alongside it:
apiVersion: v1
kind: Service
metadata:
name: dp-eu-west1
namespace: dp-eu-west1
spec:
clusterIP: None
selector:
app: dp-eu-west1
ports:
- name: probe
port: 8091
targetPort: probe
clusterIP: None is what gives each pod its stable DNS name, and the probe port
is what liveness, readiness and startup checks answer on.
What this means for you¶
The workload kind is settled, so this page describes a constraint rather than a choice. What it constrains is elsewhere: a node's identity is tied to its ordinal and its volume, so treat both as part of the node rather than as disposable cluster state. See Identity continuity.