I am looking to have a dynamic etcd cluster running inside my k8s cluster. The best way I can think of doing it dynamically (no hardcoded addresses, names, etc.) is to use DNS discovery, with the internal k8s DNS (CoreDNS).
I find detached information about SRV records created for services in k8s, and some explanations on how etcd DNS discovery works, but no complete howto.
For example:
- how does k8s name
SRVentries? - should they be named with a specific way for
etcdto be able to find them? - should any special CoreDNS setting be set?
Any help on that would be greatly appreciated.
references:
via the
Service.port[].name, which is why almost everything in kubernetes has to be a DNS-friendly name: because a lot of times, it does put them in DNS for you.A Pod that has
digor a new enoughnslookupwill then show you:and you'll see the names of the ports that the
kubernetesServiceis advertising.Yes, as one can see in the page you linked to, they need to be named one of these four:
_etcd-client_etcd-client-ssl_etcd-server_etcd-server-sslso something like this on the kubernetes side: