Lifecycle and health probes
Control desired running state, graceful shutdown, and probe timing so slow games recover without restart loops or data loss.
Disabling readiness/liveness probes masks underlying failures. If your game crashes frequently, investigate the root cause instead of loosening probe thresholds.
Running, suspended, and restart behavior
Desired state determines whether Kubernetes maintains a running replica or scales the StatefulSet to zero.
Graceful termination
The operator waits for the template stop sequence within the configured 0–600 second grace window.
Tune readiness, liveness, and startup
Override timing one probe family at a time; startup protects boot, readiness gates traffic, and liveness triggers recovery.
Each GameServer gets a <server>-probes NetworkPolicy that admits kubelet sources to the game container’s probe ports only. It is on by default through networkPolicies.probeIngress.enabled. Set that value to false to restore the older chart rule that opens every game-pod port to kubelet sources. Add any extra probe ports to networkPolicies.probePorts. See NetworkPolicy isolation and migration.
Configuring via YAML
Override probes in the GameServer spec to tune timing for your specific game:
apiVersion: gameplane.io/v1alpha1
kind: GameServer
metadata:
name: my-game
spec:
templateRef:
name: minecraft
# Set suspend to true to stop the server
suspend: false
# Set the grace period for graceful shutdown (0-600 seconds)
stopGracePeriodSeconds: 60
# Override template probes with custom timing
probes:
startup:
# Allow up to 10 minutes for the game to start
failureThreshold: 300
periodSeconds: 2
readiness:
# Check readiness every 5 seconds
periodSeconds: 5
failureThreshold: 3
liveness:
# Check liveness every 30 seconds
periodSeconds: 30
failureThreshold: 3
Suspending with idle auto-sleep
If you enable idle auto-sleep (spec.idle.enabled: true), the operator scales the server down automatically after it reports zero players for the configured idle period. The graceful termination sequence still runs — the template’s stop sequence executes with the same grace period, and data is preserved.
The flowchart below shows how the operator decides that an idle server should sleep, and what wakes it.
flowchart TD
hb["Agent heartbeat"] --> fresh{"Heartbeat fresh and<br/>phase Running?"}
fresh -- no --> freeze["Idle clock frozen<br/>(reason on status.idle)"]
fresh -- yes --> zero{"playersOnline == 0?"}
zero -- "unknown" --> freeze
zero -- "more than 0" --> reset["Clear status.idle.emptySince"]
zero -- "exactly 0" --> stamp["Stamp status.idle.emptySince"]
stamp --> long{"Older than<br/>spec.idle.afterMinutes?"}
long -- no --> wait["Keep waiting"]
long -- yes --> mark["Write idle-asleep-since annotation"]
mark --> soft["softStop: module stop sequence,<br/>wait for not-ready, scale to 0"]
soft --> asleep["Phase Suspended,<br/>reason IdleAsleep, PVC kept"]
asleep --> wake{"wakeWindows tick,<br/>POST :wake, or sentinel<br/>connection?"}
wake -- yes --> clear["Clear marker, pod returns"]
To wake a sleeping server when a player connects, turn on Wake on connect in the server’s Lifecycle settings (v0.4.0). It is off by default (spec.idle.wakeOnConnect, default false). While the server sleeps, a small pod holds its ports, which costs one extra pod per sleeping server. For UDP-only games the first join attempt only wakes the server, so the player joins on retry.
For more details, see the spec.idle configuration in the architecture docs.
Understanding phases and transitions
- Pending → Starting → Running: The pod is initializing and probes are passing.
- Running (steady state): The game is healthy and accepting connections.
- Stopping: The grace period is active; the template stop sequence is running if defined.
- Stopped: The pod has been forcibly terminated (grace period expired or no stop sequence).
- Suspended: The pod is scaled to zero via
spec.suspend=true. Data is preserved; use Start to resume. - Failed: The pod crashed and is not recovering. Check the console and logs.
Hover over the phase badge on the server overview to see the current condition and reason.
Next guide: Ownership and danger zone