From 702a5d5e49b553144291b5e2447fbe6930862cf3 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 27 May 2018 14:53:22 -0500 Subject: [PATCH] docs: document more auto service discovery --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 60866e3..35b94f9 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,32 @@ Flags: * `DELETE /routes/{serverAddress}` Deletes an existing route for the given `serverAddress` +## Using kubernetes service auto-discovery + +When running `mc-router` as a kubernetes pod and you pass the `--in-kube-cluster` command-line argument, then +it will automatically watch for any services annotated with `mc-router.itzg.me/externalServerName`. The value +of the annotation will be registered as the external hostname Minecraft clients would used to connect to the +routed service. The service's clusterIP and target port are used as the routed backend. + +For example, start `mc-router`'s container spec with + +```yaml +image: itzg/mc-router +name: mc-router +args: ["--in-kube-cluster"] +``` + +and configure the backend minecraft server's service with the annotation: + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: mc-forge + annotations: + "mc-router.itzg.me/externalServerName": "external.host.name" +``` + ## Example kubernetes deployment [This example deployment](docs/k8s-example-auto.yaml)