A FleetAutoscaler automatically scales a Fleet up or down based on various policies including buffer capacity, webhooks, counters, lists, schedules, and WebAssembly modules. It continuously monitors the Fleet and adjusts replica counts to maintain desired capacity.
API Version
autoscaling.agones.dev/v1
Kind
FleetAutoscaler
Resource Structure
Buffer Policy
Counter Policy
Webhook Policy
apiVersion : autoscaling.agones.dev/v1
kind : FleetAutoscaler
metadata :
name : fleet-autoscaler-example
spec :
fleetName : fleet-example
policy :
type : Buffer
buffer :
bufferSize : 5
minReplicas : 10
maxReplicas : 20
sync :
type : FixedInterval
fixedInterval :
seconds : 30
Spec Fields
The spec field defines the autoscaling configuration.
fleetName
Name of the Fleet to attach to and control. Must be an existing Fleet in the same namespace as this FleetAutoscaler.
policy
Autoscaling policy that determines how the Fleet should be scaled. Different policy types provide different scaling algorithms.
Show Policy Configuration
Type of autoscaling policy. Options:
Buffer - Maintain a buffer of ready GameServers
Webhook - Use external webhook for scaling decisions
Counter - Beta (CountsAndLists flag) Scale based on counter capacity
List - Beta (CountsAndLists flag) Scale based on list capacity
Schedule - Beta (ScheduledAutoscaler flag) Apply policies on schedule
Chain - Beta (ScheduledAutoscaler flag) Chain multiple policies
Wasm - Alpha (WasmAutoscaler flag) Use WebAssembly module
Buffer Policy
Buffer policy configuration. Maintains a buffer of ready and reserved GameServers.
Show Buffer Policy Fields
spec.policy.buffer.bufferSize
Size of the buffer of ready and reserved GameServers. Can be an absolute number (e.g., 5) or a percentage (e.g., 20%).
Absolute: Must be at least 1, and maxReplicas must be ≥ bufferSize
Percentage: Must be between 1% and 99%, and minReplicas must be at least 1
spec.policy.buffer.minReplicas
Minimum fleet size. Must be smaller than maxReplicas. When bufferSize is absolute, minReplicas can be 0. When bufferSize is percentage, must be at least 1 to prevent scaling to zero.
spec.policy.buffer.maxReplicas
Maximum fleet size. Must be bigger than both minReplicas and bufferSize (when absolute).
Webhook Policy
Webhook policy configuration. Delegates scaling decisions to an external HTTP endpoint.
Show Webhook Policy Fields
URL of the webhook endpoint. Either url or service must be specified, but not both.
spec.policy.webhook.service
Kubernetes service reference for the webhook. Either url or service must be specified, but not both.
spec.policy.webhook.service.name
Name of the service.
spec.policy.webhook.service.namespace
Namespace of the service.
spec.policy.webhook.service.path
Path to append to the service URL.
spec.policy.webhook.caBundle
PEM-encoded CA bundle for validating the webhook’s certificate when using HTTPS.
Counter Policy
Beta Feature (CountsAndLists flag)Counter policy configuration. Scales based on aggregate counter capacity across the Fleet.
Show Counter Policy Fields
Name of the Counter to track.
spec.policy.counter.bufferSize
Size of the buffer of available counter capacity. Can be absolute (e.g., 100) or percentage (e.g., 20%). Must be greater than 0.
Absolute: maxCapacity must be ≥ bufferSize
Percentage: Must be 1-99%, and minCapacity must be at least 1
spec.policy.counter.minCapacity
Minimum aggregate counter capacity. Must be smaller than maxCapacity and bigger than bufferSize (when absolute). Can be 0 when bufferSize is absolute.
spec.policy.counter.maxCapacity
Maximum aggregate counter capacity. Must be bigger than both minCapacity and bufferSize (when absolute).
List Policy
Beta Feature (CountsAndLists flag)List policy configuration. Scales based on aggregate list capacity across the Fleet.
Name of the List to track.
spec.policy.list.bufferSize
Size of the buffer based on available list capacity. Can be absolute (e.g., 100) or percentage (e.g., 20%). Must be greater than 0.
Absolute: maxCapacity must be ≥ bufferSize
Percentage: Must be 1-99%, and minCapacity must be at least 1
spec.policy.list.minCapacity
Minimum aggregate list capacity. Must be smaller than maxCapacity and bigger than bufferSize (when absolute). Can be 0 when bufferSize is absolute.
spec.policy.list.maxCapacity
Maximum aggregate list capacity. Must be bigger than both minCapacity and bufferSize (when absolute).
Schedule Policy
Beta Feature (ScheduledAutoscaler flag)Schedule policy configuration. Applies a policy during specific time periods.
Show Schedule Policy Fields
spec.policy.schedule.between
Time period during which the policy is eligible to be applied.
spec.policy.schedule.between.start
Start datetime (RFC3339 format). Policy is eligible once this time is reached. If not set or in the past, policy is eligible immediately.
spec.policy.schedule.between.end
End datetime (RFC3339 format). Policy is no longer eligible after this time. If not set, policy remains eligible indefinitely after start.
spec.policy.schedule.activePeriod
Defines when within the eligible period the policy is actually applied.
spec.policy.schedule.activePeriod.timezone
Timezone for startCron (e.g., America/New_York). Defaults to UTC. Do not use CRON_TZ or TZ in the cron expression.
spec.policy.schedule.activePeriod.startCron
UNIX cron expression defining when policy should be applied. If not set, policy is always applied within start/end period. Must use standard UNIX cron syntax.
spec.policy.schedule.activePeriod.duration
How long the policy remains active after being applied. Uses Go duration syntax (e.g., 2h30m, 300s). If not set, duration is indefinite.
spec.policy.schedule.policy
The FleetAutoscalerPolicy to apply during active periods. Can be any policy type (Buffer, Webhook, Counter, List, etc.).
Chain Policy
Beta Feature (ScheduledAutoscaler flag)Chain policy configuration. Allows chaining multiple policies with evaluation order.
Each chain entry contains: Unique identifier for this chain entry. If not set, defaults to the array index. All IDs must be unique within the chain.
Policy type for this chain entry (Buffer, Webhook, Counter, List, Schedule, etc.).
spec.policy.chain[].[policy-fields]
The policy configuration fields appropriate to the specified type. Each chain entry must have exactly one policy type configured.
Wasm Policy
Alpha Feature (WasmAutoscaler flag)WebAssembly policy configuration. Uses a Wasm module for custom scaling logic.
spec.policy.wasm.function
Name of the exported function to call in the Wasm module.
Configuration values passed to the Wasm module on startup.
Source of the Wasm module.
spec.policy.wasm.from.url
URL configuration for fetching the Wasm module. Uses same structure as webhook URL configuration.
Hash of the Wasm module for integrity verification.
sync
Configuration for when the autoscaler runs. Controls the frequency of autoscaling checks.
spec.sync.type
string
default: "FixedInterval"
Type of sync strategy. Currently only FixedInterval is supported.
Fixed interval sync configuration.
spec.sync.fixedInterval.seconds
Time in seconds between each autoscaling evaluation. Must be greater than 0.
Status Fields
The status field reflects the current state of the FleetAutoscaler.
currentReplicas
Current number of GameServer replicas in the Fleet, as last observed by the autoscaler.
desiredReplicas
Desired number of GameServer replicas for the Fleet, as last calculated by the autoscaler.
lastScaleTime
Last time the FleetAutoscaler scaled the attached Fleet.
ableToScale
Indicates whether the autoscaler can access and scale the target Fleet. False if the Fleet doesn’t exist or is inaccessible.
scalingLimited
Indicates whether the calculated scale was capped by minReplicas or maxReplicas constraints. True when the desired scale exceeds the configured limits.
lastAppliedPolicy
ID of the last applied policy in a Chain policy. Used for tracking policy transitions. Only populated when using Chain policy type.
When using webhook policy, the FleetAutoscaler sends HTTP POST requests to the configured endpoint.
{
"uid" : "unique-request-id" ,
"name" : "fleet-example" ,
"namespace" : "default" ,
"status" : {
"replicas" : 10 ,
"readyReplicas" : 8 ,
"reservedReplicas" : 1 ,
"allocatedReplicas" : 5 ,
"counters" : {},
"lists" : {}
},
"labels" : {
"agones.dev/fleet" : "fleet-example"
},
"annotations" : {}
}
{
"uid" : "unique-request-id" ,
"scale" : true ,
"replicas" : 15
}
Must match the UID from the request for correlation.
Whether to scale the Fleet. Set to false to prevent scaling.
Target replica count for the Fleet. Ignored if scale is false.
Scaling Behavior
Buffer Policy
The buffer policy maintains a buffer of non-allocated GameServers:
Calculates available capacity: readyReplicas + reservedReplicas
Compares against buffer size requirement
Scales up if buffer is too small
Scales down if buffer is too large
Never scales below minReplicas or above maxReplicas
Reserved GameServers don’t trigger scale up but prevent scale down
Counter/List Policy
Counter and List policies work similarly:
Aggregates counter/list capacity and count across Fleet
Calculates available capacity: total capacity - total count
Compares against buffer size
Adjusts Fleet replicas to maintain buffer
Respects min/max capacity constraints
Schedule Policy
Schedule policy evaluates time-based conditions:
Checks if current time is within between.start and between.end
If startCron is set, waits for cron trigger
When triggered, applies the configured policy
If duration is set, deactivates policy after duration expires
Falls back to no scaling when policy is inactive
Chain Policy
Chain policy evaluates policies in order:
Iterates through chain entries in array order
Evaluates each policy’s conditions
Applies first matching policy
Tracks which policy was applied in status
Logs transitions between policies
Notes
FleetAutoscalers must be in the same namespace as the Fleet they control.
When using percentage-based buffer sizes, ensure minReplicas is at least 1 to prevent the Fleet from scaling to zero when there are no allocated GameServers.
The autoscaler runs on the interval specified in sync.fixedInterval.seconds. More frequent checks consume more resources but provide faster response to load changes.
Webhook endpoints should respond quickly (within a few seconds) to prevent autoscaling delays. Implement timeouts and retries in your webhook service.
Reserved GameServers count toward available capacity in buffer calculations, which prevents unwanted scale-up when reservations are active.