Skip to main content
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

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

spec.fleetName
string
required
Name of the Fleet to attach to and control. Must be an existing Fleet in the same namespace as this FleetAutoscaler.

policy

spec.policy
object
required
Autoscaling policy that determines how the Fleet should be scaled. Different policy types provide different scaling algorithms.

Buffer Policy

spec.policy.buffer
object
Buffer policy configuration. Maintains a buffer of ready and reserved GameServers.

Webhook Policy

spec.policy.webhook
object
Webhook policy configuration. Delegates scaling decisions to an external HTTP endpoint.

Counter Policy

spec.policy.counter
object
Beta Feature (CountsAndLists flag)Counter policy configuration. Scales based on aggregate counter capacity across the Fleet.

List Policy

spec.policy.list
object
Beta Feature (CountsAndLists flag)List policy configuration. Scales based on aggregate list capacity across the Fleet.

Schedule Policy

spec.policy.schedule
object
Beta Feature (ScheduledAutoscaler flag)Schedule policy configuration. Applies a policy during specific time periods.

Chain Policy

spec.policy.chain
array
Beta Feature (ScheduledAutoscaler flag)Chain policy configuration. Allows chaining multiple policies with evaluation order.

Wasm Policy

spec.policy.wasm
object
Alpha Feature (WasmAutoscaler flag)WebAssembly policy configuration. Uses a Wasm module for custom scaling logic.

sync

spec.sync
object
Configuration for when the autoscaler runs. Controls the frequency of autoscaling checks.

Status Fields

The status field reflects the current state of the FleetAutoscaler.

currentReplicas

status.currentReplicas
int32
Current number of GameServer replicas in the Fleet, as last observed by the autoscaler.

desiredReplicas

status.desiredReplicas
int32
Desired number of GameServer replicas for the Fleet, as last calculated by the autoscaler.

lastScaleTime

status.lastScaleTime
timestamp
Last time the FleetAutoscaler scaled the attached Fleet.

ableToScale

status.ableToScale
boolean
Indicates whether the autoscaler can access and scale the target Fleet. False if the Fleet doesn’t exist or is inaccessible.

scalingLimited

status.scalingLimited
boolean
Indicates whether the calculated scale was capped by minReplicas or maxReplicas constraints. True when the desired scale exceeds the configured limits.

lastAppliedPolicy

status.lastAppliedPolicy
string
ID of the last applied policy in a Chain policy. Used for tracking policy transitions. Only populated when using Chain policy type.

Webhook Request/Response Format

When using webhook policy, the FleetAutoscaler sends HTTP POST requests to the configured endpoint.

Request Format

{
  "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": {}
}

Response Format

{
  "uid": "unique-request-id",
  "scale": true,
  "replicas": 15
}
uid
string
required
Must match the UID from the request for correlation.
scale
boolean
required
Whether to scale the Fleet. Set to false to prevent scaling.
replicas
int32
required
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:
  1. Calculates available capacity: readyReplicas + reservedReplicas
  2. Compares against buffer size requirement
  3. Scales up if buffer is too small
  4. Scales down if buffer is too large
  5. Never scales below minReplicas or above maxReplicas
  6. Reserved GameServers don’t trigger scale up but prevent scale down

Counter/List Policy

Counter and List policies work similarly:
  1. Aggregates counter/list capacity and count across Fleet
  2. Calculates available capacity: total capacity - total count
  3. Compares against buffer size
  4. Adjusts Fleet replicas to maintain buffer
  5. Respects min/max capacity constraints

Schedule Policy

Schedule policy evaluates time-based conditions:
  1. Checks if current time is within between.start and between.end
  2. If startCron is set, waits for cron trigger
  3. When triggered, applies the configured policy
  4. If duration is set, deactivates policy after duration expires
  5. Falls back to no scaling when policy is inactive

Chain Policy

Chain policy evaluates policies in order:
  1. Iterates through chain entries in array order
  2. Evaluates each policy’s conditions
  3. Applies first matching policy
  4. Tracks which policy was applied in status
  5. 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.

Build docs developers (and LLMs) love