Windows Gameservers
GameServers
on Kubernetes nodes with the Windows operating system.Warning
RunningGameServers
on Windows nodes is currently Alpha, and any feedback
would be appreciated.
Prerequisites
The following prerequisites are required to create a GameServer:
- A Kubernetes cluster with the UDP port range 7000-8000 open on each node. Creating the firewall.
- Agones controller installed in the targeted cluster
- kubectl properly configured
- Netcat which is already installed on most Linux/macOS distributions, for windows you can use WSL.
If you don’t have a Kubernetes cluster you can follow these instructions to create a cluster on Google Kubernetes Engine (GKE), Minikube or Azure Kubernetes Service (AKS), and install Agones.
For the purpose of this guide we’re going to use the simple-game-server example as the GameServer container. This example is a very simple UDP server written in Go. Don’t hesitate to look at the code of this example for more information.
Ensure that you have some nodes to your cluster that are running Windows.
Objectives
- Create a GameServer on a Windows node.
- Connect to the GameServer.
1. Create a GameServer
Note
Starting with version 0.3, the simple-game-server example is compiled as a multi-arch docker image that will run on both Linux and Windows. To ensure that the game server runs on a Windows node, a nodeSelector of"kubernetes.io/os": windows
must be added to the game server specification.
Create a GameServer using the following command:
kubectl create -f https://raw.githubusercontent.com/googleforgames/agones/release-1.44.0/examples/simple-game-server/gameserver-windows.yaml
You should see a successful output similar to this:
gameserver.agones.dev/simple-game-server-4ss4j created
Verify that the GameServer becomes Ready by running:
kubectl get gameservers
It should look something like this:
NAME STATE ADDRESS PORT NODE AGE
simple-game-server-7pjrq Ready 35.233.183.43 7190 agones 3m
Take a note of the Game Server IP address and ports.
For the full details of the YAML file head to the GameServer Specification Guide
2. Connect to the GameServer
Note
If you have Agones installed on Google Kubernetes Engine, and are using Cloud Shell for your terminal, UDP is blocked. For this step, we recommend SSH’ing into a running VM in your project, such as a Kubernetes node. You can click the ‘SSH’ button on the Google Compute Engine Instances page to do this. Runtoolbox
on GKE Node to run docker container with tools and then nc
command would be available.
You can now communicate with the Game Server:
Note
If you do not have netcat installed
(i.e. you get a response of nc: command not found
),
you can install netcat by running sudo apt install netcat
.
If you are on Windows, you can alternatively install netcat on WSL, or download a version of netcat for Windows from nmap.org.
nc -u {IP} {PORT}
Hello World !
ACK: Hello World !
EXIT
You can finally type EXIT
which tells the SDK to run the Shutdown command, and therefore shuts down the GameServer
.
If you run kubectl describe gameserver
again - either the GameServer will be gone completely, or it will be in Shutdown
state, on the way to being deleted.
Next Steps
- Make a local copy of the simple-game-server fleet configuration , modify it to include a node selector, and use it to go through the Quickstart: Create a Game Server Fleet.
- If you want to use your own GameServer container make sure you have properly integrated the Agones SDK.
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.
Last modified October 9, 2024: Release 1.44.0 (#4013) (24c3673)