0

我已经使用 kops 和入口 nginx 控制器在 aws 上部署了一个应用程序。

据我了解,入口控制器似乎允许公开部署在集群中的每个服务。所以这让我想知道安全性和身份验证。

我的项目的架构是什么?我在一个集群中部署了 3 个服务:

  1. -client-ui(前端)

  2. -authentication-api(创建/生成/验证 JWT 令牌并调用其他服务,如 data-api)

  3. -data-api(一种在数据库中创建/读取/更新/删除敏感数据的 API)

所以问题是:如果 Ingress 控制器公开所有服务,如果不允许用户访问,你如何限制对特定服务的访问?

在这种情况下,data-api 应该只能从 authentication-api 访问。因此,如果在我的浏览器中输入 www.client-ui.com/data/getXXX 显然我应该无法访问该端点。如果他的 jwt 令牌已经过验证,我应该只能从 authentication-api 做到这一点。

所以我猜一些 api 应该只能从集群内部访问,而有些应该是公开的!?

你能解释一下我该怎么做吗?

谢谢

4

1 回答 1

1

Depending on the cloud provider, there are different annotations on the ingress services for that. What you want is an internal load balancer for a specific ingress resource. In your case (AWS) this should be:

annotations: service.beta.kubernetes.io/aws-load-balancer-internal: "true"

See:

于 2018-12-07T17:08:52.397 回答