我正在GKE上运行Kong API网关,并试图添加我自己的服务。
我有三个吊舱
cassandrakongapiindex和2个服务(节点端口)
apiindex (80/443/8080端口开放)kong-proxy(8000/8001/8443)我正在尝试将apiindex api添加到API网关,使用
curl -i -X POST http://kong-proxy:8001/apis -d 'name=test‘-d’uris=/ -d 'upstream_url=http://apiindex/‘
但是http://kong-proxy:8000/回来了
503 {“消息”:“服务不可用”}
当我在curl -i -X POST http://kong-proxy:8001/apis -d 'name=test' -d 'uris=/' -d 'upstream_url=http://httpbin.org/'中添加一些公共网站时,它工作得很好。
curl http://apiindex/从kong pod返回200。
是否可以在不公开apiindex服务的情况下使用kong添加API?
发布于 2017-07-17 10:57:09
您需要在kubernetes https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/中使用服务的完全限定名(FQDN)。
所以不用apiindex而是需要使用apiindex.default.svc.cluster.local
curl -i -X POST http://kong-proxy:8001/apis -d 'name=testapi‘-d’uris=/ -d 'upstream_url=http://apiindex.default.svc.cluster.local/‘
https://stackoverflow.com/questions/45107277
复制相似问题