首页 > 解决方案 > 在 K8S 集群中使用 KeyCloak 网关

问题描述

我在本地成功运行 KeyCloak 网关,为 Kubernetes 仪表板提供 Google OIDC 身份验证。但是,当应用程序部署为集群本身的 pod 时,使用相同的设置会导致错误。

当网关在 K8S pod 中运行时,我看到的错误是:

unable to exchange code for access token    {"error": "invalid_request: Credentials in post body and basic Authorization header do not match"}

我使用以下选项调用网关:

--enable-logging=true
--enable-self-signed-tls=true
--listen=:443
--upstream-url=https://mydashboard
--discovery-url=https://accounts.google.com
--client-id=<client id goes here>
--client-secret=<secret goes here>
--resources=uri=/*

将这些设置应用于 pod 中的容器后,我可以浏览到网关,重定向到 Google 以登录,然后重定向回生成上述错误的网关。

什么可以解释在本地运行应用程序和在会产生上述错误的 pod 中运行它之间的差异?

标签: kuberneteskeycloak-gatekeeper

解决方案


这最终证明是复制/粘贴失败,客户端密码不正确。错误消息在这里没有太大帮助,但至少它是一个简单的修复。


推荐阅读