Skip to content

Commit 702a5d5

Browse files
committed
docs: document more auto service discovery
1 parent 50ff433 commit 702a5d5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,32 @@ Flags:
2929
* `DELETE /routes/{serverAddress}`
3030
Deletes an existing route for the given `serverAddress`
3131

32+
## Using kubernetes service auto-discovery
33+
34+
When running `mc-router` as a kubernetes pod and you pass the `--in-kube-cluster` command-line argument, then
35+
it will automatically watch for any services annotated with `mc-router.itzg.me/externalServerName`. The value
36+
of the annotation will be registered as the external hostname Minecraft clients would used to connect to the
37+
routed service. The service's clusterIP and target port are used as the routed backend.
38+
39+
For example, start `mc-router`'s container spec with
40+
41+
```yaml
42+
image: itzg/mc-router
43+
name: mc-router
44+
args: ["--in-kube-cluster"]
45+
```
46+
47+
and configure the backend minecraft server's service with the annotation:
48+
49+
```yaml
50+
apiVersion: v1
51+
kind: Service
52+
metadata:
53+
name: mc-forge
54+
annotations:
55+
"mc-router.itzg.me/externalServerName": "external.host.name"
56+
```
57+
3258
## Example kubernetes deployment
3359
3460
[This example deployment](docs/k8s-example-auto.yaml)

0 commit comments

Comments
 (0)