Skip to content

Commit 58b8578

Browse files
committed
Update getting started guides with kubectl custom columns
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
1 parent 3c7304d commit 58b8578

2 files changed

Lines changed: 30 additions & 19 deletions

File tree

docs/create_fleet.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,18 @@ allocated a `GameServer` out of the fleet, and you can now connect your players
244244
A handy trick for checking to see how many `GameServers` you have `Allocated` vs `Ready`, run the following:
245245

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

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

252252
```
253-
State: Allocated
254-
State: Ready
255-
State: Ready
256-
State: Ready
257-
State: Ready
253+
NAME STATUS IP PORT
254+
simple-udp-tfqn7-c9tqz Ready 192.168.39.150 [map[name:default port:7136]]
255+
simple-udp-tfqn7-g8fhq Allocated 192.168.39.150 [map[name:default port:7148]]
256+
simple-udp-tfqn7-p8wnl Ready 192.168.39.150 [map[name:default port:7453]]
257+
simple-udp-tfqn7-t6bwp Ready 192.168.39.150 [map[name:default port:7228]]
258+
simple-udp-tfqn7-wkb7b Ready 192.168.39.150 [map[name:default port:7226]]
258259
```
259260

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

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

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

278279
```
279-
State: Allocated
280+
NAME STATUS IP PORT
281+
simple-udp-tfqn7-g8fhq Allocated 192.168.39.150 [map[name:default port:7148]]
280282
```
281283

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

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

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

328-
We should now have four `Ready` `GameServers` and one `Allocated`. We can check this by running `kubectl describe gs | grep State`.
330+
We should now have four `Ready` `GameServers` and one `Allocated`.
331+
332+
We can check this by running `kubectl get gs -o=custom-columns=NAME:.metadata.name,STATUS:.status.state,IP:.status.address,PORT:.status.ports`.
329333

330334
```
331-
State: Allocated
332-
State: Ready
333-
State: Ready
334-
State: Ready
335-
State: Ready
335+
NAME STATUS IP PORT
336+
simple-udp-tfqn7-c9tz7 Ready 192.168.39.150 [map[name:default port:7136]]
337+
simple-udp-tfqn7-g8fhq Allocated 192.168.39.150 [map[name:default port:7148]]
338+
simple-udp-tfqn7-n0wnl Ready 192.168.39.150 [map[name:default port:7453]]
339+
simple-udp-tfqn7-hiiwp Ready 192.168.39.150 [map[name:default port:7228]]
340+
simple-udp-tfqn7-w8z7b Ready 192.168.39.150 [map[name:default port:7226]]
336341
```
337342

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

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

docs/create_gameserver.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,15 @@ You might also be interested to see the `Events` section, which outlines when va
131131
Let's retrieve the IP address and the allocated port of your Game Server :
132132

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

137-
This should ouput your Game Server IP address and port. (eg `10.130.65.208:7936`)
137+
This should ouput your Game Server IP address and ports, eg:
138+
139+
```
140+
NAME STATUS IP PORT
141+
simple-udp Ready 192.168.99.100 [map[name:default port:7614]]
142+
```
138143

139144
### 3. Connect to the GameServer
140145

0 commit comments

Comments
 (0)