mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-08 14:14:52 +00:00
* feat(dns): implement extra dns names for machine in m.internal This implements <machinename>.m.internal and <machineid>.m.internal as names that can be queried in the cluster. Listing all machines/services is not implemented, this may come later. Fixes: #340 Signed-off-by: Miek Gieben <miek@miek.nl> * Implement getting all machine address A query for m.internal returns all ip address There is no overflow check Signed-off-by: Miek Gieben <miek@miek.nl> --------- Signed-off-by: Miek Gieben <miek@miek.nl>
166 lines
3.4 KiB
Markdown
166 lines
3.4 KiB
Markdown
# Internal DNS
|
|
|
|
Services can be addressed on the internal WireGuard network by service name, service ID, or a machine-scoped service name:
|
|
|
|
## Service name
|
|
|
|
```
|
|
$ nslookup nats.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: nats.internal
|
|
Address: 10.210.0.2
|
|
Name: nats.internal
|
|
Address: 10.210.1.2
|
|
```
|
|
|
|
```
|
|
$ nslookup worker.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: worker.internal
|
|
Address: 10.210.0.3
|
|
Name: worker.internal
|
|
Address: 10.210.0.4
|
|
Name: worker.internal
|
|
Address: 10.210.1.3
|
|
Name: worker.internal
|
|
Address: 10.210.1.4
|
|
```
|
|
|
|
## Service ID
|
|
|
|
```
|
|
$ nslookup 3ecb3a8bbec5fd3f46efb056a934714a.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: 3ecb3a8bbec5fd3f46efb056a934714a.internal
|
|
Address: 10.210.0.4
|
|
```
|
|
|
|
## Machine ID scoped service name
|
|
|
|
```
|
|
$ nslookup 0903f0ee483aa97d559eeeaac5e22283.m.nats.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: nats.internal
|
|
Address: 10.210.1.2
|
|
```
|
|
|
|
```
|
|
$ nslookup 0903f0ee483aa97d559eeeaac5e22283.m.worker.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: worker.internal
|
|
Address: 10.210.1.3
|
|
Name: worker.internal
|
|
Address: 10.210.1.4
|
|
```
|
|
|
|
## IP Ordering Mode
|
|
|
|
Additionally, the IP ordering preference can be specified with a `rr` (round-robin) or `nearest` subdomain prefix.
|
|
|
|
### `rr` (round-robin) _current default_
|
|
|
|
Randomly shuffled order on each lookup.
|
|
|
|
```
|
|
$ nslookup rr.worker.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: rr.worker.internal
|
|
Address: 10.210.0.3
|
|
Name: rr.worker.internal
|
|
Address: 10.210.0.4
|
|
Name: rr.worker.internal
|
|
Address: 10.210.1.3
|
|
Name: rr.worker.internal
|
|
Address: 10.210.1.4
|
|
|
|
$ nslookup rr.worker.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: rr.worker.internal
|
|
Address: 10.210.0.4
|
|
Name: rr.worker.internal
|
|
Address: 10.210.1.3
|
|
Name: rr.worker.internal
|
|
Address: 10.210.1.4
|
|
Name: rr.worker.internal
|
|
Address: 10.210.0.3
|
|
```
|
|
|
|
## Nearest scope
|
|
|
|
Returns machine-local instances first.
|
|
|
|
`machine-a`:
|
|
|
|
```
|
|
$ nslookup nearest.worker.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.0.3
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.0.4
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.1.3
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.1.4
|
|
```
|
|
|
|
`machine-b`:
|
|
|
|
```
|
|
$ nslookup nearest.worker.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.1.3
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.1.4
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.0.3
|
|
Name: nearest.worker.internal
|
|
Address: 10.210.0.4
|
|
```
|
|
|
|
The prefixes can be used with service ID and machine-scoped service names, as well (e.g. `nearest.3ecb3a8bbec5fd3f46efb056a934714a.internal` or `rr.0903f0ee483aa97d559eeeaac5e22283.m.worker.internal`).
|
|
|
|
## Machine name
|
|
|
|
Machines can be addressed too on the internal WireGuard network, either by name of by ID, these names are
|
|
available from the `m.internal` zone.
|
|
|
|
```
|
|
$ nslookup machine-1.m.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: machine-1.m.internal
|
|
Address: 10.210.0.1
|
|
```
|
|
|
|
## Machine ID
|
|
|
|
```
|
|
$ nslookup c337f00600de51ef4375c9a9a267dba5.m.internal
|
|
Server: 127.0.0.11
|
|
Address: 127.0.0.11#53
|
|
|
|
Name: c337f00600de51ef4375c9a9a267dba5.m.internal
|
|
Address: 10.210.0.1
|
|
```
|