Conventions used below
<keep-host>– public FQDN where users access Keep (e.g.keep.example.com)
<gitlab-host>– URL of your GitLab instance (e.g.gitlab.example.com)
<registry-host>– container registry that stores images (omit if you use the public images)- Kubernetes namespace
keep– feel free to change it everywhere if you prefer another namespace.
1. Prerequisites
| What | Why | 
|---|---|
| Kubernetes cluster & keepnamespace | Where Keep, oauth2‑proxy and Services live | 
| ingress‑nginx (or compatible) | Provides the auth_requestfeature oauth2‑proxy uses | 
| GitLab 15 + at https://<gitlab-host> | OpenID‑Connect issuer | 
| Helm 3.x & offline charts/images (optional) | If your cluster has no Internet egress | 
2. Create the GitLab OAuth application
- GitLab ▸ Admin → Applications → New
- Name → keep‑sso
- Redirect URI → https://<keep-host>/oauth2/callback
- Scopes → openid profile email(+read_apiif you plan to gate access by group/project)
- Save – copy the generated Application ID and Secret.
3. Kubernetes secrets & config
4. Deploy oauth2‑proxy (Helm)
ssl-insecure-skip-verify: "true" under extraArgs.
5. Patch (or create) Keep’s Ingress resource
Add three annotations so ingress‑nginx delegates auth to the Service:6. Environment variables for Keep
7. Quick validation
- https://<keep-host>→ redirect to GitLab → sign in → return to Keep.
- DevTools ▸ Network → /api/auth/sessionreturns 200.
8. Troubleshooting
| Symptom | Common cause & remedy | 
|---|---|
| TLS error x509: certificate signed by unknown authority | Mount your GitLab CA ( provider-ca-file) or setssl-insecure-skip-verify=true(dev only). | 
| Ingress logs auth request unexpected status: 502 | auth-urlis pointing at the external host – use the internal Service DNS (http://oauth2-proxy.keep.svc.cluster.local). | 
| Browser loops at /signin?callbackUrl=… | ① set-xauthrequestnot enabled, or ②auth-response-headersnot set, or ③ backend receives calls through oauth2‑proxy (API_URLwrong). | 
| Redirect to 0.0.0.0:3000or pod name | NEXTAUTH_URLmissing at build time; rebuild UI or override env. | 
| 401 from /oauth2/autheven with cookie | Cookie expired / clocks out of sync. Clear cookie and re‑login. | 

