【发布时间】:2018-05-14 11:27:09
【问题描述】:
我让入口 nginx 在gcloud 中工作。但是,当我看到带有命令kubectl log 的日志时
$ kubectl logs nginx-ingress-controller-59f55c679c-zcr24
myhost.com/clients"
10.28.0.1 - [10.28.0.1] - - [14/May/2018:09:00:59 +0000] "GET /api/users/2/10 HTTP/1.1" 304 0 "http://myhost.com/clients" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0" 796 0.083 [default-back-main-80] 10.28.0.93:1337 0 0.083 304
2018/05/14 09:01:00 [notice] 10982#10982: *6937489 "/api/(.*)" matches "/api/users/1/10", client: 10.28.0.1, server: myhost.com, request: "GET /api/users/1/10 HTTP/1.1", host: "myhost.com", referrer: "http://myhost.com/clients"
2018/05/14 09:01:00 [notice] 10982#10982: *6937489 rewritten data: "/users/1/10", args: "", client: 10.28.0.1, server: myhost.com, request: "GET /api/users/1/10 HTTP/1.1", host: "myhost.com", referrer: "http://myhost.com/clients"
10.28.0.1 - [10.28.0.1] - - [14/May/2018:09:01:00 +0000] "GET /api/users/1/10 HTTP/1.1" 304 0 "http://myhost.com/clients" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0" 796 0.014 [default-back-main-80] 10.28.0.93:1337 0 0.014 304
这只是日志的一部分,然而,所有的 ips 都来自10.28.0.1。我想查看外部 ip,或者我的用户的 ip。
此外,ip 10.28.*.* 的根对我来说似乎有点奇怪。如果我显示我的容器的 ip,你会发现它似乎有所不同。
$ kubectl get service | awk '{print $3}'
CLUSTER-IP
10.31.243.114
10.31.245.58
10.31.241.148
10.31.240.1
我知道我的其他容器中的请求来自一个私有 ip,但是在入口容器中我应该收到我的用户的外部 ip。我怎样才能看到这些 ip?
【问题讨论】:
标签: nginx kubernetes google-kubernetes-engine kubernetes-ingress