我可以使用基本身份验证创建入口。我遵循了 kubernetes/ingress-nginx 的模板:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-with-auth
annotations:
# type of authentication
nginx.ingress.kubernetes.io/auth-type: basic
# name of the secret that contains the user/password definitions
nginx.ingress.kubernetes.io/auth-secret: basic-auth
# message to display with an appropriate context why the authentication is required
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - foo'
spec:
rules:
- host: foo.bar.com
http:
paths:
- path: /
backend:
serviceName: http-svc
servicePort: 80
它工作正常,但我需要允许没有基本身份验证的“OPTIONS”方法进行飞行前请求。关于如何做到这一点的任何指示都会非常有帮助。