我们正在gke上运行一些node.js代码,并使用googles @ google-cloud / logging-winston库直接将日志记录到stackdriver-日志记录有效,这不是问题。 我们还使用kubernetes网络策略来限制往返于我们Pod的流量。
我无法弄清楚在出口策略中允许使用哪个IP范围来使Stackdriver Logging正常工作。 当我允许所有目的地时,日志记录正在运行,但是我想缩小一点范围...
答案 0 :(得分:0)
使用以下命令可以找到发送堆栈驱动程序日志API请求的IP:
dig @8.8.8.8 googleapis.com
因此,您应该获得以下这些IP:
googleapis.com. 299 IN A 74.125.141.147
googleapis.com. 299 IN A 74.125.141.104
googleapis.com. 299 IN A 74.125.141.103
googleapis.com. 299 IN A 74.125.141.99
googleapis.com. 299 IN A 74.125.141.106
googleapis.com. 299 IN A 74.125.141.105
答案 1 :(得分:0)
我不确定使用dns答案是否有效,因为当前dns结果仅是事实的一部分。 取决于我使用的dns服务器,“挖掘”计算机所在的位置以及解析dns名称的时间,对于相同的问题,我会得到不同的答案:
使用我的本地解析器的我的电脑:
dig googleapis.com +noall +answer
; <<>> DiG 9.10.6 <<>> googleapis.com +noall +answer
;; global options: +cmd
googleapis.com. 261 IN A 216.58.207.132
使用Google的DNS服务器的我的PC:
dig @8.8.8.8 googleapis.com +noall +answer
; <<>> DiG 9.10.6 <<>> @8.8.8.8 googleapis.com +noall +answer
; (1 server found)
;; global options: +cmd
googleapis.com. 106 IN A 172.217.22.196
从在gke环境中运行的容器中运行“挖掘”:
# dig googleapis.com +noall +answer
; <<>> DiG 9.12.4-P2 <<>> googleapis.com +noall +answer
;; global options: +cmd
googleapis.com. 299 IN A 172.217.16.196
相同的gke容器,但大约10分钟后:
# dig googleapis.com +noall +answer
; <<>> DiG 9.12.4-P2 <<>> googleapis.com +noall +answer
;; global options: +cmd
googleapis.com. 299 IN A 172.217.18.164
这就是为什么我要寻找一些文档,那就是告诉我所讨论的IP网络... Google拥有这么多ip网络,只有我的4个dig命令已经用ip的4个不同网络来回答...