无法在 GKE 上将内部 API 添加到 KONG api 网关 运行
Can't add internal API to KONG api gateway running on GKE
我是 GKE 上的 运行 Kong API 网关,正在尝试添加我自己的服务。
我有3个pods
cassandra
kong
apiindex
和 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/
returns
503 {"message": "Service unavailable"}
当我在里面添加一些 public 网站时它工作正常
curl -i -X POST http://kong-proxy:8001/apis -d 'name=test' -d 'uris=/' -d 'upstream_url=http://httpbin.org/'
curl http://apiindex/
returns 200 来自 kong
连播。
是否可以在不公开 apiindex
服务的情况下使用 kong 添加 API?
您需要在 kubernetes 中使用服务的完全限定名称 (FQDN) https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
所以需要使用 apiindex.default.svc.cluster.local
而不是 apiindex
curl -i -X POST http://kong-proxy:8001/apis -d 'name=testapi' -d
'uris=/' -d 'upstream_url=http://apiindex.default.svc.cluster.local/'
我是 GKE 上的 运行 Kong API 网关,正在尝试添加我自己的服务。
我有3个pods
cassandra
kong
apiindex
和 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/
returns
503 {"message": "Service unavailable"}
当我在里面添加一些 public 网站时它工作正常
curl -i -X POST http://kong-proxy:8001/apis -d 'name=test' -d 'uris=/' -d 'upstream_url=http://httpbin.org/'
curl http://apiindex/
returns 200 来自 kong
连播。
是否可以在不公开 apiindex
服务的情况下使用 kong 添加 API?
您需要在 kubernetes 中使用服务的完全限定名称 (FQDN) https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
所以需要使用 apiindex.default.svc.cluster.local
apiindex
curl -i -X POST http://kong-proxy:8001/apis -d 'name=testapi' -d 'uris=/' -d 'upstream_url=http://apiindex.default.svc.cluster.local/'