根据以下问题的建议,我正在尝试使用 oauth2-proxy 使用此图表在 Consul UI 中添加身份验证:
https://github.com/hashicorp/consul/issues/1720#issuecomment-184845561
Consul 的安装使用了v0.34.1版本的图表。Consul UI 入口配置如下:
kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
name: consul-ingress
labels:
app: consul
app.kubernetes.io/managed-by: Helm
chart: consul-helm
component: ui
heritage: Helm
release: consul
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: nginx
meta.helm.sh/release-name: consul
meta.helm.sh/release-namespace: consulRequest-Email
nginx.ingress.kubernetes.io/auth-signin: https://auth.mydomain.com/oauth2/start?rd=$escaped_request_uri
nginx.ingress.kubernetes.io/auth-url: https://auth.mydomain.com/oauth2/auth
spec:
tls:
- hosts:
- consul.mydomain.com
secretName: consul.mydomain.com-tls
rules:
- host: consul.mydomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: consul-consul-ui
servicePort: 80
关于 oauth2-proxy 我使用的是4.0.0 版本。
当我访问提供 Consul UI 服务的域 consul.mydomain.com 时,它会重定向到使用 Google 登录,在输入 Google 凭据后,它会重定向到https://auth.mydomain.com ,并返回404 错误。
我检查了 oauth2-proxy 日志,它设法创建了令牌。但是,在 Consul 日志中,并没有新的记录。