This guide walks you through creating a Kubernetes cluster optimized for Agones on major cloud providers.
Google Cloud (GKE)
Recommended for new users
Amazon Web Services (EKS)
Enterprise production workloads
Microsoft Azure (AKS)
Azure cloud native
Google Kubernetes Engine (GKE)
Prerequisites
- Google Cloud SDK (
gcloud) installed and authenticated
- GCP project with billing enabled
- Required APIs enabled (Kubernetes Engine API, Compute Engine API)
Using gcloud CLI
Set Project and Region
Configure your GCP project and preferred region:export PROJECT_ID=your-project-id
export REGION=us-west1
export ZONE=us-west1-c
gcloud config set project $PROJECT_ID
gcloud config set compute/zone $ZONE
Create GKE Cluster
Create a GKE cluster with Agones-optimized settings:gcloud container clusters create agones-cluster \
--zone=$ZONE \
--machine-type=e2-standard-4 \
--num-nodes=4 \
--enable-image-streaming \
--network=default \
--cluster-version=1.33 \
--tags=game-server \
--scopes="gke-default" \
--workload-pool=$PROJECT_ID.svc.id.goog
Cluster creation takes approximately 5-10 minutes.
Create agones-system Node Pool
Add a dedicated node pool for Agones system components:gcloud container node-pools create agones-system \
--cluster=agones-cluster \
--zone=$ZONE \
--machine-type=e2-standard-4 \
--num-nodes=1 \
--node-labels=agones.dev/agones-system=true \
--node-taints=agones.dev/agones-system=true:NoExecute
Create Firewall Rule
Allow UDP traffic for game servers:gcloud compute firewall-rules create game-server-firewall \
--allow=udp:7000-8000 \
--target-tags=game-server \
--source-ranges=0.0.0.0/0 \
--description="Allow game server traffic"
Get Credentials
Configure kubectl to access your cluster:gcloud container clusters get-credentials agones-cluster --zone=$ZONE
GKE Autopilot
GKE Autopilot requires the GKEAutopilotExtendedDurationPods feature gate to be enabled in Agones. This is enabled by default in recent versions.
Create GKE Autopilot Cluster
gcloud container clusters create-auto agones-autopilot \
--region=$REGION \
--project=$PROJECT_ID
Amazon Elastic Kubernetes Service (EKS)
Prerequisites
- AWS CLI (
aws) installed and configured
eksctl tool installed (recommended)
- IAM permissions to create EKS clusters
- VPC with appropriate subnet configuration
Using eksctl
Create Cluster Configuration
Create a file named agones-cluster.yaml:apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: agones-cluster
region: us-west-2
version: "1.34"
vpc:
cidr: 10.0.0.0/16
nat:
gateway: Single
nodeGroups:
- name: game-servers
instanceType: t3.xlarge
desiredCapacity: 4
minSize: 2
maxSize: 10
volumeSize: 50
labels:
workload: game-servers
tags:
game-server: "true"
securityGroups:
attachIDs:
- sg-game-servers
- name: agones-system
instanceType: t3.xlarge
desiredCapacity: 1
minSize: 1
maxSize: 2
volumeSize: 50
labels:
agones.dev/agones-system: "true"
taints:
- key: agones.dev/agones-system
value: "true"
effect: NoExecute
- name: agones-metrics
instanceType: t3.xlarge
desiredCapacity: 1
minSize: 1
maxSize: 2
volumeSize: 50
labels:
agones.dev/agones-metrics: "true"
taints:
- key: agones.dev/agones-metrics
value: "true"
effect: NoExecute
Create the Cluster
Deploy the EKS cluster:eksctl create cluster -f agones-cluster.yaml
This process takes approximately 15-20 minutes.
Configure Security Group
Add ingress rules for game server traffic:# Get the security group ID
SECURITY_GROUP=$(aws eks describe-cluster \
--name agones-cluster \
--query "cluster.resourcesVpcConfig.clusterSecurityGroupId" \
--output text)
# Allow UDP traffic for game servers
aws ec2 authorize-security-group-ingress \
--group-id $SECURITY_GROUP \
--protocol udp \
--port 7000-8000 \
--cidr 0.0.0.0/0
Verify Connection
Confirm kubectl can access the cluster:
EKS with AWS Load Balancer Controller
For production deployments, install the AWS Load Balancer Controller to properly expose Agones services.
Install AWS Load Balancer Controller
export CLUSTER_NAME=agones-cluster
export AWS_REGION=us-west-2
# Create IAM policy
aws iam create-policy \
--policy-name AWSLoadBalancerControllerIAMPolicy \
--policy-document file://iam-policy.json
# Create service account
eksctl create iamserviceaccount \
--cluster=$CLUSTER_NAME \
--namespace=kube-system \
--name=aws-load-balancer-controller \
--attach-policy-arn=arn:aws:iam::ACCOUNT_ID:policy/AWSLoadBalancerControllerIAMPolicy \
--approve
# Install controller
helm install aws-load-balancer-controller \
eks/aws-load-balancer-controller \
-n kube-system \
--set clusterName=$CLUSTER_NAME
Azure Kubernetes Service (AKS)
Prerequisites
- Azure CLI (
az) installed and authenticated
- Active Azure subscription
- Service principal or managed identity
- Resource group created
Using Azure CLI
Set Environment Variables
Configure your Azure environment:export RESOURCE_GROUP=agones-rg
export LOCATION=eastus
export CLUSTER_NAME=agones-cluster
export NODE_COUNT=4
Create Resource Group
Create a dedicated resource group:az group create \
--name $RESOURCE_GROUP \
--location $LOCATION
Create AKS Cluster
Create the AKS cluster with default node pool:az aks create \
--resource-group $RESOURCE_GROUP \
--name $CLUSTER_NAME \
--node-count $NODE_COUNT \
--node-vm-size Standard_D4s_v3 \
--kubernetes-version 1.33 \
--enable-managed-identity \
--enable-node-public-ip \
--generate-ssh-keys
Cluster creation takes approximately 10-15 minutes.
Add agones-system Node Pool
Create a dedicated node pool for Agones system components:az aks nodepool add \
--resource-group $RESOURCE_GROUP \
--cluster-name $CLUSTER_NAME \
--name agonessystem \
--node-count 1 \
--node-vm-size Standard_D4s_v3 \
--node-taints agones.dev/agones-system=true:NoExecute \
--labels agones.dev/agones-system=true
Add agones-metrics Node Pool
Create a node pool for metrics (optional):az aks nodepool add \
--resource-group $RESOURCE_GROUP \
--cluster-name $CLUSTER_NAME \
--name agonesmetrics \
--node-count 1 \
--node-vm-size Standard_D4s_v3 \
--node-taints agones.dev/agones-metrics=true:NoExecute \
--labels agones.dev/agones-metrics=true
Configure Network Security Group
Add a rule to allow game server traffic:# Get the node resource group name
NODE_RESOURCE_GROUP=$(az aks show \
--resource-group $RESOURCE_GROUP \
--name $CLUSTER_NAME \
--query nodeResourceGroup \
--output tsv)
# Get the NSG name
NSG_NAME=$(az network nsg list \
--resource-group $NODE_RESOURCE_GROUP \
--query "[0].name" \
--output tsv)
# Add security rule
az network nsg rule create \
--resource-group $NODE_RESOURCE_GROUP \
--nsg-name $NSG_NAME \
--name game-server-rule \
--priority 100 \
--direction Inbound \
--access Allow \
--protocol Udp \
--source-address-prefixes '*' \
--source-port-ranges '*' \
--destination-address-prefixes '*' \
--destination-port-ranges 7000-8000
Get Credentials
Configure kubectl to access your cluster:az aks get-credentials \
--resource-group $RESOURCE_GROUP \
--name $CLUSTER_NAME
Verify Cluster Setup
Regardless of your cloud provider, verify your cluster is ready:
You should see all nodes in Ready status:
NAME STATUS ROLES AGE VERSION
default-pool-1 Ready <none> 5m v1.33.0
default-pool-2 Ready <none> 5m v1.33.0
default-pool-3 Ready <none> 5m v1.33.0
default-pool-4 Ready <none> 5m v1.33.0
agones-system-pool-1 Ready <none> 3m v1.33.0
kubectl get nodes --show-labels
kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
Next Steps
Install Agones
Now that your cluster is ready, proceed with installing Agones.