In this quickstart, we will create a Kubernetes cluster, and populate it with the resource types that power Agones.
- Setting up a Google Kubernetes Engine (GKE) cluster
- Setting up a Minikube cluster
- Enabling creation of RBAC resources
- Installing Agones
- What's next
Follow these steps to create a cluster and install Agones directly on Google Kubernetes Engine (GKE).
Take the following steps to enable the Kubernetes Engine API:
- Visit the Kubernetes Engine page in the Google Cloud Platform Console.
- Create or select a project.
- Wait for the API and related services to be enabled. This can take several minutes.
- Enable billing for your project.
- If you are not an existing GCP user, you may be able to enroll for a $300 US Free Trial credit.
To complete this quickstart, we can use either Google Cloud Shell or a local shell.
Google Cloud Shell is a shell environment for managing resources hosted on Google Cloud Platform (GCP). Cloud Shell comes preinstalled with the gcloud and kubectl command-line tools. gcloud provides the primary command-line interface for GCP, and kubectl provides the command-line interface for running commands against Kubernetes clusters.
If you prefer using your local shell, you must install the gcloud and kubectl command-line tools in your environment.
To launch Cloud Shell, perform the following steps:
- Go to Google Cloud Platform Console
- From the top-right corner of the console, click the Activate Google Cloud Shell button:

- A Cloud Shell session opens inside a frame at the bottom of the console. Use this shell to run
gcloudandkubectlcommands. - Set a compute zone in your geographical region with the following command. The compute zone will be something like
us-west1-a. A full list can be found here.gcloud config set compute/zone [COMPUTE_ZONE]
To install gcloud and kubectl, perform the following steps:
- Install the Google Cloud SDK, which includes the
gcloudcommand-line tool. - Initialize some default configuration by running the following command.
- When asked
Do you want to configure a default Compute Region and Zone? (Y/n)?, enterYand choose a zone in your geographical region of choice.
gcloud init
- When asked
- Install the
kubectlcommand-line tool by running the following command:gcloud components install kubectl
A cluster consists of at least one cluster master machine and multiple worker machines called nodes: Compute Engine virtual machine instances that run the Kubernetes processes necessary to make them part of the cluster.
gcloud container clusters create [CLUSTER_NAME] --cluster-version=1.9 \
--no-enable-legacy-authorization \
--tags=game-server \
--enable-basic-auth \
--password=supersecretpassword \
--scopes=https://www.googleapis.com/auth/devstorage.read_only,compute-rw,cloud-platform \
--num-nodes=3 \
--machine-type=n1-standard-1Flag explanations:
- cluster-version: Agones requires Kubernetes version 1.9+. Once the default version reaches 1.9, this will no longer be necessary.
- no-enable-legacy-authorization: This enables RBAC, the authorization scheme used by Agones to control access to resources.
- tags: Defines the tags that will be attached to new nodes in the cluster. This is to grant access through ports via the firewall created in the next step.
- enable-basic-auth/password: Sets the master auth scheme for interacting with the cluster.
- scopes: Defines the Oauth scopes required by the nodes.
- num-nodes: The number of nodes to be created in each of the cluster's zones. Default: 3
- machine-type: The type of machine to use for nodes. Default: n1-standard-1.
Finally, let's tell gcloud that we are speaking with this cluster, and get auth credentials for kubectl to use.
gcloud config set container/cluster [CLUSTER_NAME]
gcloud container clusters get-credentials [CLUSTER_NAME]We need a firewall to allow UDP traffic to nodes tagged as game-server via ports 7000-8000.
gcloud compute firewall-rules create game-server-firewall \
--allow udp:7000-8000 \
--target-tags game-server \
--description "Firewall to allow game server udp traffic"Continue to Enabling creation of RBAC resources
This will setup a Minikube cluster, running on an agones profile.
First, install Minikube, which may also require you to install a virtualisation solution, such as VirtualBox as well.
Note: due to some issues with the 0.26.x release, we recommend installing version 0.25.2 of minikube until they are resolved.
Let's use a minikube profile for agones.
minikube profile agonesThe following command starts a local minikube cluster via virtualbox - but this can be replaced by a vm-driver of your choice.
minikube start --kubernetes-version v1.9.4 --vm-driver virtualbox \
--extra-config=apiserver.Admission.PluginNames=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota \
--extra-config=apiserver.Authorization.Mode=RBACTo install Agones, a service account needs permission to create some special RBAC resource types.
# Kubernetes Engine
kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole cluster-admin --user `gcloud config get-value account`
# Minikube
kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin --serviceaccount=kube-system:defaultThis will install Agones in your cluster.
We can install Agones to the cluster using the install.yaml file.
kubectl apply -f https://github.com/GoogleCloudPlatform/agones/raw/release-0.2.0/install/yaml/install.yamlYou can also find the install.yaml in the latest agones-install zip from the releases archive.
Note: Installing Agones with the
intall.yamlwill setup the TLS certificates stored in this repository for securing kubernetes webhooks communication. If you want to generates new certificates or use your own, we recommend using the helm installation.
Also, we can install Agones using Helm package manager. If you want more details and configuration options see the Helm installation guide for Agones
To confirm Agones is up and running, run the following command:
kubectl describe --namespace agones-system podsIt should describe the single pod created in the agones-system namespace, with no error messages or status. The Conditions section should look like this:
Conditions:
Type Status
Initialized True
Ready True
PodScheduled True
That's it! This creates the Custom Resource Definitions that power Agones and allows us to define resources of type GameServer.
- Go through the Create a Game Server Quickstart