Installing Agones on AWS Elastic Kubernetes Service using Terraform
Installation
You can use Terraform to provision your Amazon EKS (Elastic Kubernetes Service) cluster and install Agones on it using the Helm Terraform provider.
An example of the EKS submodule config file can be found here: Terraform configuration with Agones submodule
Copy this file into a separate folder.
Configure your AWS CLI tool CLI configure:
aws configure
Initialise your terraform:
terraform init
Creating Cluster
By editing modules.tf
you can change the parameters that you need to. For instance, the - machine_type
variable.
Configurable parameters:
- cluster_name - the name of the GKE cluster (default is “agones-terraform-example”)
- agones_version - the version of agones to install (default is the latest version from the Helm repository)
- machine_type - EC2 instance type for hosting game servers (default is “t2.large”)
- node_count - count of game server nodes for the default node pool (default is “4”)
Now you can create an EKS cluster and deploy Agones on EKS:
terraform apply [-var agones_version="1.3.0"]
After deploying the cluster with Agones, you can get or update your kubeconfig by using:
aws eks --region us-west-2 update-kubeconfig --name agones-cluster
With the following output:
Added new context arn:aws:eks:us-west-2:601646756426:cluster/agones-cluster to /Users/user/.kube/config
Switch kubectl
context to the recently created one:
kubectl config use-context arn:aws:eks:us-west-2:601646756426:cluster/agones-cluster
Check that you are authenticated against the recently created Kubernetes cluster:
kubectl get nodes
Uninstall the Agones and delete EKS cluster
Run the following commands to delete all Terraform provisioned resources if you choose helm:
helm delete --purge agones
terraform destroy
Note
There is an issue with the AWS Terraform provider: https://github.com/terraform-providers/terraform-provider-aws/issues/9101 Due to this issue you should remove helm release first (as stated above), otherwiseterraform destroy
will timeout and never succeed.
Remove all created resources manually in that case, namely: 3 Auto Scaling groups, EKS cluster, and a VPC with all dependent resources.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.