Challenge 1: Deploy the Agones Game Server Deployment Platform on Kubernetes

Next Challenge

Introduction

In this challenge, you will learn how to deploy Agones, a library for hosting, running and scaling dedicated game servers on Kubernetes.

Description

Your task is to deploy an Agones game server in Google Cloud, that will include the following:

  • Install Agones using Helm on a freshly provisioned Google Kubernetes Engine (GKE) Autopilot cluster using the CLI.

  • Install Open Match v1.8.1 to your cluster and apply an evaluator. Writing the evaluator customizations doesn’t fit within the time constraints for this challenge, so the code has been provided. You can install Open Match and apply the evaluator with the following command:
    export OM_NS=open-match
    export OM_VER=1.8.1
    helm repo add $OM_NS https://open-match.dev/chart/stable
    helm repo update
    helm install $OM_NS \
      --create-namespace --namespace $OM_NS $OM_NS/open-match \
      --version $OM_VER \
      --set open-match-customize.enabled=true \
      --set open-match-customize.evaluator.enabled=true \
      --set open-match-customize.evaluator.replicas=1 \
      --set open-match-override.enabled=true \
      --set open-match-core.swaggerui.enabled=false \
      --set global.kubernetes.horizontalPodAutoScaler.frontend.maxReplicas=1 \
      --set global.kubernetes.horizontalPodAutoScaler.backend.maxReplicas=1 \
      --set global.kubernetes.horizontalPodAutoScaler.query.minReplicas=1 \
      --set global.kubernetes.horizontalPodAutoScaler.query.maxReplicas=1 \
      --set global.kubernetes.horizontalPodAutoScaler.evaluator.maxReplicas=1 \
      --set query.replicas=1 \
      --set frontend.replicas=1 \
      --set backend.replicas=1 \
      --set redis.master.resources.requests.cpu=0.1 \
      --set redis.replica.replicaCount=0 \
      --set redis.metrics.enabled=false
    
  • Deploy a simple game server to verify your Agones installation.
  • Test the deployment by ensuring that the game server is running and accessible. To test, you will need to install nc to your Cloud Shell with:
    sudo apt-get -y install netcat
    

Note Although you can create this cluster using the Google Cloud Console UI, we encourage you to explore and figure out how to create clusters using the gcloud CLI tool.

Note The reason we are installing Agones with Helm and not YAML is because this is more representative of a production scenario. The Agones documentation for this type of installation is also more detailed and explanatory.

Note Open Match isn’t used until Challenge 5, and is not a requirement for Agones functionality. Open Match can sometimes take time to enter a ready state which is why we are installing it now. We are installing with Helm because it makes it easy to see the customizations that are being made to the default install.

Success Criteria

  • A GKE Autopilot cluster has been provisioned.
  • Agones is successfully installed on the GKE cluster.
  • Open Match is installed and its associated pods are running. Pods being in the READY state is not required at this time.
  • A game server is created and running without errors.
  • The game server is accessible and functioning as expected.
    • Use the nc commands given in the Agones docs to show the game server working.
    • Exit the server using nc and use kubectl to show that it is no longer running.

Tips

  • Familiarize yourself with the Agones documentation before starting the deployment.
  • Use the Google Cloud Console to set up the GKE cluster.
  • Follow the recommended best practices and configuration options for Agones to ensure a successful deployment.
  • You might want to consider what the best source of documentation for creating your cluster is … the Google or Agones docs …
  • Test the game server deployment thoroughly to ensure it meets the success criteria.
  • The nc command interaction is a little misleading. After executing the command, it will move the cursor to a new line. Type anything you want into the new line and hit enter.

Learning Resources

Next Challenge