Peer discovery lets members of a distributed application find and communicate with one another. Keeping discovery in DNS avoids requiring the application to call the Kubernetes API directly. section 16.1.5
A headless Service associated with a StatefulSet resolves to the IP addresses of its Pods. Each Pod also receives an individual A or AAAA record, while SRV records provide Pod addresses and ports. section 16.1.5
MongoDB replica-set discovery
A MongoDB client can list replica addresses explicitly, such as quiz-0, quiz-1, and quiz-2, or use the SRV connection URI mongodb+srv://quiz-pods.kiada.svc.cluster.local. The Service port must be named mongodb so MongoDB finds the expected SRV record. section 16.1.5
