Skip to content

Commit

Permalink
Updated Minikube documentation
Browse files Browse the repository at this point in the history
This includes:
* Correct commands for the newer versions of minikube
* Guidance on increasing cpu and/or memory as needed
* Workarounds if one can't connect locally to a GameServer

Closes googleforgames#1536
Closes googleforgames#1990
  • Loading branch information
markmandel committed Jun 17, 2021
1 parent 16196ec commit 7ce123d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 15 deletions.
6 changes: 3 additions & 3 deletions site/content/en/docs/Getting Started/create-gameserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ simple-game-server-7pjrq Ready 35.233.183.43 7190 agones 4m
```

{{< alert title="Note" color="info">}}
If you have Agones installed on minikube the address printed will not be
reachable from the host machine. Instead, use the output of `minikube ip` for
the following section.
If you have Agones installed on minikube, or other local Kubernetes tooling, and you are having issues connecting
to the `GameServer`, please check the
[Minikube local connection workarounds]({{% ref "/docs/Installation/Creating Cluster/minikube.md#local-connection-workarounds" %}}).
{{< /alert >}}

### 3. Connect to the GameServer
Expand Down
64 changes: 52 additions & 12 deletions site/content/en/docs/Installation/Creating Cluster/minikube.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,68 @@ a virtualisation solution, such as [VirtualBox][vb] as well.
[minikube]: https://minikube.sigs.k8s.io/docs/start/
[vb]: https://www.virtualbox.org

## Creating an `agones` profile
## Starting Minikube

Create a minikube profile for `agones` so you don't overlap any of the minikube clusters you are already running.
Minikube will need to be started with the supported version of Kubernetes that is supported with Agones, via the
`--kubernetes-version` command line flag.

```bash
minikube start -p agones
```
Set the minkube profile to `agones`.
Optionally, we also recommend starting with an `agones` profile, using `-p` to keep this cluster separate from any other
clusters you may have running with Minikube.

```bash
minikube profile agones
minikube start --kubernetes-version v{{% k8s-version %}}.{{% minikube-k8s-minor-version %}} -p agones
```

## Starting Minikube
Check the official [minikube start](https://minikube.sigs.k8s.io/docs/commands/start/) reference for more options that
may be required for your platform of choice.

The following command starts a local minikube cluster via virtualbox - but this can be
replaced by a [vm-driver](https://github.com/kubernetes/minikube#requirements) of your choice.
{{< alert title="Note" color="info">}}
You may need to increase the `--cpu` or `--memory` values for your minikube instance, depending on what resources are
available on the host and/or how many GameServers you wish to run locally.
{{< /alert >}}

```bash
minikube start --kubernetes-version v{{% k8s-version %}}.{{% minikube-k8s-minor-version %}} --vm-driver virtualbox
## Local connection workarounds

Depending on your operating system and virtualization platform that you are using with Minikube, it may not be
possible to connect directly to a `GameServer` hosted on Agones as you would on a cloud hosted Kubernetes cluster.

If you are unable to do so, the following workarounds are available, and may work on your platform:

### minikube ip

Rather than using the published IP of a `GameServer` to connect, run `minikube ip` to get the local IP for the
minikube node, and connect to that address.

### Create a service

This would only be for local development, but if none of the other workarounds work, creating a Service for the
`GameServer` you wish to connect to is a valid solution, to tunnel traffic to the appropriate GameServer container.

Use the following yaml:

```yaml
apiVersion: v1
kind: Service
metadata:
name: agones-gameserver
spec:
type: LoadBalancer
selector:
agones.dev/gameserver: ${GAMESERVER_NAME}
ports:
- protocol: UDP
port: 7000 # local port
targetPort: ${GAMESERVER_CONTAINER_PORT}
```
Where `${GAMESERVER_NAME}` is replaced with the GameServer you wish to connect to, and `${GAMESERVER_CONTAINER_PORT}`
is replaced with the container port GameServer exposes for connection.

Running `minikube service list -p agones` will show you the IP and port to connect to locally in the `URL` field.

To connect to a different `GameServer`, run `kubectl edit service agones-gameserver` and edit the `${GAMESERVER_NAME}`
value to point to the new `GameServer` instance and/or the `${GAMESERVER_CONTAINER_PORT}` value as appropriate.

## Next Steps

- Continue to [Install Agones]({{< relref "../Install Agones/_index.md" >}}).

0 comments on commit 7ce123d

Please sign in to comment.