如何在golang的k8s集群dns中查找SRV记录

问题描述 投票:1回答:1

我创建了无头服务和一组有状态的Pod。使用NodeJS,我可以查找这些pod的所有IP。但是我不知道如何使用GoLang做到这一点。

dns.resolveSrv(serviceName, function (err, addresses) {
// The app performs a DNS lookup to obtain SRV records.
if (err) {
  response.end("Could not look up DNS SRV records: " + err);
   return;
}...
go kubernetes dns
1个回答
0
投票

您可以使用标准的net包在go中执行DNS查找:

© www.soinside.com 2019 - 2024. All rights reserved.