Skip to content

Commit

Permalink
Update getting started guides with kubectl custom columns
Browse files Browse the repository at this point in the history
Let's use kubectl custom columns for the getting started guides -
also fixes the issues with multiple ports.
https://kubernetes.io/docs/reference/kubectl/overview/#custom-columns
  • Loading branch information
markmandel committed Aug 14, 2018
1 parent 3c7304d commit 58b8578
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
40 changes: 23 additions & 17 deletions docs/create_fleet.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,18 @@ allocated a `GameServer` out of the fleet, and you can now connect your players
A handy trick for checking to see how many `GameServers` you have `Allocated` vs `Ready`, run the following:

```
kubectl describe gs | grep State
kubectl get gs -o=custom-columns=NAME:.metadata.name,STATUS:.status.state,IP:.status.address,PORT:.status.ports
```

This will get you a list of all the current `Status > State` of all the `GameSevers`.
This will get you a list of all the current `GameSevers` and their `Status > State`.

```
State: Allocated
State: Ready
State: Ready
State: Ready
State: Ready
NAME STATUS IP PORT
simple-udp-tfqn7-c9tqz Ready 192.168.39.150 [map[name:default port:7136]]
simple-udp-tfqn7-g8fhq Allocated 192.168.39.150 [map[name:default port:7148]]
simple-udp-tfqn7-p8wnl Ready 192.168.39.150 [map[name:default port:7453]]
simple-udp-tfqn7-t6bwp Ready 192.168.39.150 [map[name:default port:7228]]
simple-udp-tfqn7-wkb7b Ready 192.168.39.150 [map[name:default port:7226]]
```

### 5. Scale down the Fleet
Expand All @@ -270,13 +271,14 @@ Run `kubectl edit fleet simple-udp` and replace `replicas: 5` with `replicas 0`,

It may take a moment for all the `GameServers` to shut down, so let's watch them all and see what happens:
```
watch 'kubectl describe gs | grep State'
watch kubectl get gs -o=custom-columns=NAME:.metadata.name,STATUS:.status.state,IP:.status.address,PORT:.status.ports
```

Eventually, one by one they will be removed from the list, and you should simply see:

```
State: Allocated
NAME STATUS IP PORT
simple-udp-tfqn7-g8fhq Allocated 192.168.39.150 [map[name:default port:7148]]
```

That lone `Allocated` `GameServer` is left all alone, but still running!
Expand All @@ -290,7 +292,7 @@ Since we've only got one allocation, we'll just grab the details of the IP and p
only allocated `GameServer`:

```
kubectl get $(kubectl get fleetallocation -o name) -o jsonpath='{.status.GameServer.status.address}':'{.status.GameServer.status.port}'
kubectl get $(kubectl get fleetallocation -o name) -o jsonpath='{.status.GameServer.staatus.GameServer.status.ports[0].port}'
```

This should output your Game Server IP address and port. (eg `10.130.65.208:7936`)
Expand Down Expand Up @@ -325,14 +327,17 @@ Let's also allocate ourselves a `GameServer`
kubectl create -f https://github.com/GoogleCloudPlatform/agones/master/examples/simple-udp/server/fleetallocation.yaml -o yaml
```

We should now have four `Ready` `GameServers` and one `Allocated`. We can check this by running `kubectl describe gs | grep State`.
We should now have four `Ready` `GameServers` and one `Allocated`.

We can check this by running `kubectl get gs -o=custom-columns=NAME:.metadata.name,STATUS:.status.state,IP:.status.address,PORT:.status.ports`.

```
State: Allocated
State: Ready
State: Ready
State: Ready
State: Ready
NAME STATUS IP PORT
simple-udp-tfqn7-c9tz7 Ready 192.168.39.150 [map[name:default port:7136]]
simple-udp-tfqn7-g8fhq Allocated 192.168.39.150 [map[name:default port:7148]]
simple-udp-tfqn7-n0wnl Ready 192.168.39.150 [map[name:default port:7453]]
simple-udp-tfqn7-hiiwp Ready 192.168.39.150 [map[name:default port:7228]]
simple-udp-tfqn7-w8z7b Ready 192.168.39.150 [map[name:default port:7226]]
```

In production, we'd likely be changing a `containers > image` configuration to update our `Fleet`
Expand All @@ -344,7 +349,8 @@ with a Container Port of `6000`.

> NOTE: This will make it such that you can no longer connect to the simple-udp game server.
Run `watch 'kubectl describe gs | grep "Container Port"'` until you can see that there are
Run `watch kubectl get gs -o=custom-columns=NAME:.metadata.name,STATUS:.status.state,CONTAINERPORT:.spec.ports[0].containerPort`
until you can see that there are
one of `7654`, which is the `Allocated` `GameServer`, and four instances to `6000` which
is the new configuration.

Expand Down
9 changes: 7 additions & 2 deletions docs/create_gameserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,15 @@ You might also be interested to see the `Events` section, which outlines when va
Let's retrieve the IP address and the allocated port of your Game Server :

```
kubectl get gs simple-udp -o jsonpath='{.status.address}:{.status.port}'
kubectl get gs -o=custom-columns=NAME:.metadata.name,STATUS:.status.state,IP:.status.address,PORT:.status.ports
```

This should ouput your Game Server IP address and port. (eg `10.130.65.208:7936`)
This should ouput your Game Server IP address and ports, eg:

```
NAME STATUS IP PORT
simple-udp Ready 192.168.99.100 [map[name:default port:7614]]
```

### 3. Connect to the GameServer

Expand Down

0 comments on commit 58b8578

Please sign in to comment.