GameServerSet is a set of GameServers with a shared template. It manages the creation and lifecycle of identical GameServer replicas, similar to how Kubernetes ReplicaSets manage Pods. GameServerSets are typically created and managed by Fleets, but can also be created directly.
API Version
agones.dev/v1
Kind
GameServerSet
Resource Structure
Spec Fields
Thespec field defines the desired configuration for the GameServerSet.
replicas
Number of GameServers that should be in this set. This is the desired replica count that the GameServerSet controller will maintain.
scheduling
Scheduling strategy that determines how GameServers are distributed across the cluster:
Packed- Bin packs GameServers onto nodes to maximize resource efficiency (ideal for cloud/dynamic clusters)Distributed- Spreads GameServers across nodes for better fault tolerance (ideal for static clusters)
allocationOverflow
Labels and annotations to apply to GameServers when the number of Allocated GameServers drops below the desired replicas. This helps identify and manage GameServers that should be preserved despite being below the replica count.
priorities
Beta Feature (CountsAndLists flag)Configuration that alters scale down logic based on available capacity. Priority sorting is in descending importance (position 0 is checked first).
- For
Packedstrategy: Priority list acts as a tie-breaker within nodes - For
Distributedstrategy: Entire set is sorted by this priority list for deletion order
template
GameServer template to apply for this GameServerSet. All GameServers created by this set will use this template.
Status Fields
Thestatus field reflects the current state of the GameServerSet.
replicas
Total number of current GameServer replicas in this set.
readyReplicas
Number of GameServer replicas that are in the Ready state and available for allocation.
reservedReplicas
Number of GameServer replicas that are in the Reserved state. Reserved GameServers can be allocated but won’t be scaled down.
allocatedReplicas
Number of GameServer replicas that are in the Allocated state (actively hosting game sessions).
shutdownReplicas
Number of GameServer replicas that are in the Shutdown state (being terminated).
players
Alpha Feature (PlayerTracking flag)Current total player capacity and count aggregated across this GameServerSet.
counters
Beta Feature (CountsAndLists flag)Aggregated counter capacity and count for this GameServerSet.
lists
Beta Feature (CountsAndLists flag)Aggregated list capacity and count for this GameServerSet.
Immutability
The GameServerSet template is immutable after creation. Once a GameServerSet is created, you cannot modify thespec.template field. This is validated during updates and any attempt to change the template will be rejected.
If you need to change the GameServer specification:
- Create a new GameServerSet with the updated template
- Scale up the new GameServerSet
- Scale down the old GameServerSet
- Delete the old GameServerSet when no longer needed
Relationship to Fleets and GameServers
GameServerSets sit between Fleets and GameServers in the Agones resource hierarchy:- Fleet creates and manages one or more GameServerSets
- GameServerSet creates and manages individual GameServers
- Each GameServer is owned by exactly one GameServerSet
- GameServers have label
agones.dev/gameserverset: <gameserverset-name> - GameServers created by a Fleet also have
agones.dev/fleet: <fleet-name>
Scale Subresource
GameServerSet supports the Kubernetes scale subresource, allowing you to scale the set using:Common Use Cases
Direct Management
While typically created by Fleets, you can create GameServerSets directly when:- You want simple scaling without rolling update capabilities
- You need multiple independent sets of GameServers with different configurations
- You’re implementing custom fleet management logic
Testing and Development
GameServerSets are useful for:- Testing GameServer configurations before deploying a Fleet
- Running smaller sets of game servers for development
- Isolating different game server versions or configurations
Allocation Overflow Management
UseallocationOverflow to:
- Mark GameServers that exceed desired capacity
- Apply special handling for overflow instances
- Track and manage surplus allocated GameServers
Notes
GameServerSet names are used as labels on GameServers, so they must not exceed 63 characters (Kubernetes label value maximum).
The GameServerSet status is defined as a subresource, similar to Kubernetes ReplicaSets. Status updates don’t change the resource version of the main object.
Allocated GameServers are never automatically deleted by the GameServerSet controller, even if replicas is reduced to 0. They must be explicitly shut down via the SDK or deleted manually.
