# Windows Gameservers

> Run `GameServers` on Kubernetes nodes with the Windows operating system.

---

LLMS index: [llms.txt](/site/llms.txt)

---

<div class="alert alert-warning" role="alert"><div class="h4 alert-heading" role="heading">Warning</div>


Running `GameServers` on Windows nodes is currently Alpha, and any feedback
would be appreciated.
</div>


## Prerequisites


<p>The following prerequisites are required to create a GameServer:</p>
<ol>
<li>A Kubernetes cluster with the UDP port range 7000-8000 open on each node. <a href="/site/docs/installation/creating-cluster/gke/#creating-the-firewall">Creating the firewall.</a></li>
<li>Agones controller installed in the targeted cluster</li>
<li>kubectl properly configured</li>
<li>Netcat which is already installed on most Linux/macOS distributions, for windows you can use <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">WSL</a>.</li>
</ol>
<p>If you don’t have a Kubernetes cluster you can follow <a href="/site/docs/installation/">these instructions</a> to create a cluster on Google Kubernetes Engine (GKE), Minikube or Azure Kubernetes Service (AKS), and install Agones.</p>
<p>For the purpose of this guide we’re going to use the
<a href="https://github.com/agones-dev/agones/blob/release-1.58.0/examples/simple-game-server/" target="_blank" data-proofer-ignore>simple-game-server</a>
 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.</p>



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

<div class="alert alert-info" role="alert"><div class="h4 alert-heading" role="heading">Note</div>


Starting with version 0.3, the 
<a href="https://github.com/agones-dev/agones/blob/release-1.58.0/examples/simple-game-server/" target="_blank" data-proofer-ignore>simple-game-server</a>
 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.
</div>


Create a GameServer using the following command:

```bash
kubectl create -f https://raw.githubusercontent.com/googleforgames/agones/release-1.58.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:

```bash
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](/site/docs/reference/gameserver/)


### 2. Connect to the GameServer

<div class="alert alert-info" role="alert"><div class="h4 alert-heading" role="heading">Note</div>


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](https://console.cloud.google.com/compute/instances)
  page to do this.
  Run `toolbox` on GKE Node to run docker container with tools and then `nc` command would be available.
</div>


You can now communicate with the Game Server:

<div class="alert alert-info" role="alert"><div class="h4 alert-heading" role="heading">Note</div>


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](https://docs.microsoft.com/en-us/windows/wsl/install-win10),
or download a version of netcat for Windows from [nmap.org](https://nmap.org/ncat/).
</div>


```
nc -u {IP} {PORT}
Hello World !
ACK: Hello World !
EXIT
```

You can finally type `EXIT` which tells the SDK to run the [Shutdown command](/site/docs/guides/client-sdks/#shutdown), 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 
<a href="https://github.com/agones-dev/agones/blob/release-1.58.0/examples/simple-game-server/fleet.yaml" target="_blank" data-proofer-ignore>fleet configuration</a>
,
modify it to include a node selector, and use it to go through the [Quickstart: Create a Game Server Fleet](/site/docs/getting-started/create-fleet/).
- If you want to use your own GameServer container make sure you have properly integrated the [Agones SDK](/site/docs/guides/client-sdks/).
