我无法找到一种方法来更新我的密钥斗篷守门器的基本URL。我的配置可以很好地使用设置为基本URL(ex:https://monitoring.example.com/)的服务,而不是定制的基本路径(ex:https://monitoring.example.com/prometheus)。
我的yaml配置是:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: prometheus-deployment
spec:
replicas: 1
template:
metadata:
name: prometheus
spec:
containers:
- name: prometheus
image: quay.io/coreos/prometheus:latest
args:
- '--web.external-url=https://monitoring.example.com/prometheus'
- '--web.route-prefix=/prometheus
- name: proxy
image: keycloak/keycloak-gatekeeper:5.0.0
imagePullPolicy: Always
args:
- --resource=uri=/*
- --discovery-url=https://auth.example.com/auth/realms/MYREALM
- --client-id=prometheus
- --client-secret=XXXXXXXX
- --listen=0.0.0.0:5555
- --enable-logging=true
- --enable-json-logging=true
- --upstream-url=http://127.0.0.1:9090/prometheus我的问题是能够为sidecar设置一个不同的基本URL路径(“/prometheus”),因为当我打开https://monitoring.example.com/prometheus时,我会收到一个307重定向到https://monitoring.example.com/oauth/authorize?state=XXXXXXX,而应该是https://monitoring.example.com/prometheus/oauth/authorize?state=XXXXXXX
我尝试使用参数“--重定向- URL =https://monitoring.example.com/prometheus”,但这仍然将我重定向到相同的URL。
编辑:
我的目标是能够保护多个普罗米修斯并限制他们的进入。我还在寻找一个解决方案来设置有关领域或客户端的权限。我的意思是,例如,一些密钥披风用户应该能够看到/prometheus-dev而不是/prometheus-prod的内容。
EDIT2:
我漏掉了参数‘base_uri’。当我将它设置为"/prometheus“并试图连接到"https://monitoring.example.com/prometheus/”时,我收到了很好的重定向"https://monitoring.example.com/prometheus/oauth/authorize?state=XXXXXXX“,但没有工作。在keycloak中,日志是:
msg:未在请求中找到会话,请重定向授权,错误:未找到身份验证会话
发布于 2019-10-10 14:12:00
在网关管理员版本7.0.0中,您可以使用以下选项之一:
--oauth-uri--base-uri但是目前,如果您使用--base-uri,那么在baseUri (即/baseUri//oauth/callback)之后,将向回调url添加一个尾随的/。但对我来说,它在oauth-uri=/baseUri/oauth中运行得很好。
发布于 2020-09-21 06:11:56
如果您在307个浏览器响应上重写位置标头,则可以完成此操作。如果您在nginx入口后面,请添加以下注释。
nginx.ingress.kubernetes.io/proxy-redirect-from: /
nginx.ingress.kubernetes.io/proxy-redirect-to: /prometheus/https://stackoverflow.com/questions/55516742
复制相似问题