nebari-dev / nebari-dev/nebari-operator

Generated SecurityPolicy uses wrong Keycloak port (8080) and missing /auth path prefix

Open
#136 2 comments 0 reactions 1 assignee View on GitHub

@viniciusdc is already working on this.

Since Aug 19, 2026.

Dominant language
Go
Stars
0
Forks
2
Avg merge
11d 6h
Merged PRs (30d)
1

Description

Summary

Enabling auth on a NebariApp doesn't redirect users to the Keycloak login page; requests return HTTP 500 instead. The operator generates a SecurityPolicy with an unreachable Keycloak URL, so Envoy Gateway can't enforce the OIDC flow.

Steps to reproduce

These steps follow the operator's own quickstart, which is what surfaced the bug.

  1. Fresh dev cluster: cd dev && make setup
  2. Install operator: make docker-build IMG=... && kind load ... && make install && make deploy IMG=...
  3. Set up the Keycloak realm: ./dev/scripts/services/keycloak/setup.sh
  4. Create a namespace, deploy a sample Deployment + Service, then apply a NebariApp with auth enabled:
kubectl create namespace demo
kubectl label namespace demo nebari.dev/managed=true

kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-app
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello
  template:
    metadata:
      labels:
        app: hello
    spec:
      containers:
      - name: hello
        image: hashicorp/http-echo
        args: ["-text=Hello"]
        ports:
        - containerPort: 5678
---
apiVersion: v1
kind: Service
metadata:
  name: hello-service
  namespace: demo
spec:
  selector:
    app: hello
  ports:
  - port: 80
    targetPort: 5678
---
apiVersion: reconcilers.nebari.dev/v1
kind: NebariApp
metadata:
  name: hello-app
  namespace: demo
spec:
  hostname: hello-app.nebari.local
  service:
    name: hello-service
    port: 80
  routing:
    tls:
      enabled: true
  auth:
    enabled: true
    provider: keycloak
    provisionClient: true
    scopes:
      - openid
      - profile
      - email
EOF
  1. Inspect the operator-generated SecurityPolicy:
kubectl describe securitypolicy hello-app-security -n demo

Expected

In the Status block at the bottom of the describe output, the Accepted condition should look like:

Status:
  Ancestors:
    Conditions:
      Status:  True
      Type:    Accepted

And requests to the app's hostname should redirect to the Keycloak login page (HTTP 302).

Actual

In the same Status block, the Accepted condition is stuck on False with an OIDC error:

Status:
  Ancestors:
    Conditions:
      Message:  OIDC: error fetching endpoints from issuer:
                  Get "http://keycloak-keycloakx-http.keycloak.svc.cluster.local:8080/realms/nebari/.well-known/openid-configuration":
                  dial tcp 10.96.71.87:8080: i/o timeout.
      Reason:   Invalid
      Status:   False
      Type:     Accepted

And requests to the app's hostname return HTTP 500 instead of redirecting:

curl -k -I https://hello-app.nebari.local

Output:

HTTP/2 500
date: ...

Root cause

The keycloakx Helm chart (the one dev/services-install uses) exposes Keycloak at:

  • Service port: 80 (not 8080)
  • Context path: /auth (not the root)

kubectl get svc -n keycloak:

NAME                      TYPE        PORT(S)
keycloak-keycloakx-http   ClusterIP   9000/TCP,80/TCP,8443/TCP

A quick reachability test from inside the cluster (e.g., kubectl run -i --rm test-curl --image=curlimages/curl -- curl -s -o /dev/null -w "%{http_code}\n" <URL>):

URL Result
http://keycloak-keycloakx-http.keycloak.svc.cluster.local:8080/realms/nebari/.well-known/openid-configuration timeout (no listener on 8080)
http://keycloak-keycloakx-http.keycloak.svc.cluster.local:80/realms/nebari/.well-known/openid-configuration 404
http://keycloak-keycloakx-http.keycloak.svc.cluster.local:80/auth/realms/nebari/.well-known/openid-configuration 200

The operator generates:

http://keycloak-keycloakx-http.keycloak.svc.cluster.local:8080/realms/nebari

The correct issuer for this dev install would be:

http://keycloak-keycloakx-http.keycloak.svc.cluster.local/auth/realms/nebari

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.