我有带有 basic_auth 的入口 Controller nginx
在我的 yaml 中,我有:
annotations:
nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: basic-auth
nginx.ingress.kubernetes.io/auth-realm: "Authentication Required"
一切正常,但我需要从 basic_auth 中排除一些 IP 地址,但我找不到解决方案。
ingress有这样的机会吗?
最佳答案
您想要使用自定义服务器代码段并使用允许/拒绝。我发现它比上面评论中的 if
推荐更优雅。
annotations:
nginx.ingress.kubernetes.io/server-snippet: |
satisfy any;
allow 66.220.144.0/20;
deny all;
要在信用到期时给予信用:此答案基于 https://serverfault.com/questions/242218/how-to-disable-http-basic-auth-in-nginx-for-a-specific-ip-range .
关于kubernetes - 入口 Controller nginx 从 basic_auth 中排除 IP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54162870/