mirror of
https://github.com/itzg/mc-router.git
synced 2024-11-25 12:05:14 +01:00
Route to k8s service port minecraft or mc-router
This commit is contained in:
parent
25575c1176
commit
5884ad12cb
11
README.md
11
README.md
@ -111,12 +111,9 @@ To test out this example, I added these two entries to my "hosts" file:
|
||||
|
||||
## 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. You can use more hostnames by splitting them with comma.
|
||||
- `mc-router.itzg.me/defaultServer` : The service's clusterIP and target port are used as the default if
|
||||
no other `externalServiceName` annotations applies.
|
||||
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. You can use more hostnames by splitting them with comma.
|
||||
- `mc-router.itzg.me/defaultServer` : The service's clusterIP and target port are used as the default if no other `externalServiceName` annotations applies.
|
||||
|
||||
For example, start `mc-router`'s container spec with
|
||||
|
||||
@ -148,6 +145,8 @@ metadata:
|
||||
"mc-router.itzg.me/externalServerName": "external.host.name,other.host.name"
|
||||
```
|
||||
|
||||
mc-router will pick the service port named either `minecraft` or `mc-router`. If neither port names exist, it will use port value 25565.
|
||||
|
||||
## Example Kubernetes deployment
|
||||
|
||||
[This example deployment](docs/k8s-example-auto.yaml)
|
||||
|
@ -232,7 +232,7 @@ func (w *k8sWatcherImpl) buildDetails(service *core.Service, externalServiceName
|
||||
clusterIp := service.Spec.ClusterIP
|
||||
port := "25565"
|
||||
for _, p := range service.Spec.Ports {
|
||||
if p.Name == "mc-router" {
|
||||
if p.Name == "mc-router" || p.Name == "minecraft" {
|
||||
port = strconv.Itoa(int(p.Port))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user