API 使用 K8s Ingress 的网关身份验证 + Python

API Gateway Auth with K8s Ingress + Python

自从 关于微服务集群身份验证以来,我收到了以下更具体的问题。如何在 Kubernetes 集群中实现 API 网关模式以使用 Python 执行身份验证?这样就可以使用任何自定义的auth方法,其他微服务就不用担心这个问题了。

我的requirement/wish列表:

  1. 使用 Python 代码验证请求,处理登录和注销。
  2. 使用 K8s Ingress URL 列表或至少类似的简单 YAML 接口,这样路由就不会嵌入到服务代码中,并且可以快速更新。
  3. 解决方案应该不是最差的性能。

非常感谢任何形式的帮助

正如我们在评论中提到的。


NginX 可以处理 LDAP:

There is an article that explains the process and an official repo with an example explaining Python+LDAP+NginX for external authentication for k8s ingress.

还有a good unofficial example这个技巧


NginX 模块 ngx_http_auth_request_module 支持更简单的协议,这里是 docs and an unofficial example


可以使用其他软件解决问题: