【问题标题】:Can't add internal API to KONG api gateway running on GKE无法将内部 API 添加到 GKE 上运行的 KONG api 网关
【发布时间】:2017-07-14 16:03:15
【问题描述】:

我在 GKE 上运行 Kong API 网关并尝试添加我自己的服务。

我有 3 个豆荚

  • 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/ 返回

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?

【问题讨论】:

    标签: kubernetes kong


    【解决方案1】:

    您需要在 kubernetes 中使用服务的完全限定名称(FQDN)https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/

    所以不是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/'

    【讨论】:

      猜你喜欢
      • 2019-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-31
      • 2020-08-25
      • 1970-01-01
      • 2019-02-17
      • 1970-01-01
      相关资源
      最近更新 更多