Node Name Server service
NNS service is a service that stores node-id to IP mapping.
It exposes several interfaces to query and update the mapping:
- GRPC interface
- Prometheus HTTP targets config that can be used by
Prometheus to scrape metrics from nodes. Available at
/prometheus
- DNS GRPC. Implementation of CoreDNS grpc plugin
that could be integrated with CoreDNS to resolve node-id on DNS level. Useful for running in Kubernetes
CoreDNS Integration
NNS service acts as a CoreDNS grpc plugin that resolves A DNS requests only.
Refer to CoreDNS documentation for more details.
Here is an example of CoreDNS config map that resolves all subdomains of .node.mesh
via network service:
apiVersion: v1
data:
Corefile: |
node.mesh {
errors
log
grpc . 172.20.224.224:9090
}
.:53 {
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
metadata:
labels:
eks.amazonaws.com/component: coredns
k8s-app: kube-dns
name: coredns
namespace: kube-system
172.20.224.224
is the IP of the Net service running in cluster
Running Locally
- Build the app:
make build
- Run docker-compose
docker-compose up --build
- Add DNS record to etcd:
docker exec -it etcd etcdctl put uk-sa2203-hnode-a1-0a16 172.10.0.1
- Login to bastion:
docker exec -it bastion bash
- Check the resolution of node's hostname
dig -p 53 @coredns uk-sa2203-hnode-a1-0a16.node.mesh
...
;; ANSWER SECTION:
uk-sa2203-hnode-a1-0a16.node.mesh. 0 IN A 172.10.0.1
...