GameServer is the fundamental building block of Agones. It represents a single dedicated game server instance and manages its lifecycle from creation through allocation to shutdown.
API Version
agones.dev/v1
Kind
GameServer
Resource Structure
Spec Fields
Thespec field defines the desired configuration for the GameServer.
container
Specifies which Pod container is the game server. Only required if there is more than one container defined in the pod template.Example:
"simple-game-server"ports
Array of ports that can be exposed via the game server. Each port configuration includes:
health
Configures health checking for the running game server.
scheduling
Scheduling strategy for the GameServer pod. Options:
Packed- Aimed at dynamic Kubernetes clusters (cloud providers), bin packs resources onto nodesDistributed- Aimed at static Kubernetes clusters, distributes resources across the entire cluster
sdkServer
Parameters for the Agones SDK Server sidecar container.
template
Pod template that will be created for the GameServer. This is a standard Kubernetes
PodTemplateSpec.players
Alpha Feature (PlayerTracking flag)Configuration for player tracking features.
counters
Beta Feature (CountsAndLists flag)Configuration for tracking int64 counter values. Keys must be declared at GameServer creation time and cannot be added later.
lists
Beta Feature (CountsAndLists flag)Configuration for tracking lists of values (up to 1000 values per list). Keys must be declared at GameServer creation time and cannot be added later.
eviction
Specifies the eviction tolerance of the GameServer.
Status Fields
Thestatus field reflects the current state of the GameServer.
state
Current state of the GameServer. Possible values:
PortAllocation- Dynamically allocating GameServer is being created, port needs allocationCreating- Before the Pod is being createdStarting- Pod is being created but not yet scheduledScheduled- Pod has been scheduled (has a NodeName)RequestReady- GameServer has declared it is readyReady- GameServer is ready to accept connections from game clientsReserved- GameServer is reserved and can be allocated but not removedAllocated- GameServer has been allocated to a sessionShutdown- GameServer has shutdown, everything needs deletionError- Something went wrong, cannot be resolvedUnhealthy- GameServer has failed health checks
ports
Array of ports with their allocated host ports.
address
Primary address at which the GameServer can be reached.
addresses
Array of addresses at which the GameServer can be reached. Copy of Node.Status.addresses.
nodeName
Name of the Kubernetes node hosting this GameServer.
reservedUntil
Timestamp until which the GameServer is reserved. Only set when state is
Reserved.players
Alpha Feature (PlayerTracking flag)Current player tracking status.
counters
Beta Feature (CountsAndLists flag)Current counter values and capacities.
lists
Beta Feature (CountsAndLists flag)Current list values and capacities.
eviction
Current eviction configuration (may differ from spec if pod annotations override it).
Lifecycle
The GameServer follows this lifecycle:- PortAllocation/Creating - Initial creation
- Starting - Pod is being created
- Scheduled - Pod is scheduled to a node
- RequestReady - Game server signals readiness via SDK
- Ready - Available for allocation
- Reserved (optional) - Temporarily reserved
- Allocated - Assigned to a game session
- Shutdown - Terminating
- Shutdown
- Error
- Unhealthy
Notes
Unlike Fleet and other Agones resources, GameServer does not define status as a subresource. This allows changing multiple aspects of a GameServer in a single atomic operation, which is particularly useful for allocation.
Keys for counters and lists must be declared at GameServer creation time and cannot be dynamically added later.
