Repository navigation
fix(kiosk): grant cluster read and metrics RBAC to kubestellar-console - #200
mrbobbytables wants to merge 2 commits into
Conversation
Add dedicated ServiceAccount, ClusterRole, and ClusterRoleBinding allowing kubestellar-console to query nodes, namespaces, pods, services, events, configmaps, workload controllers, metrics.k8s.io, and tenancy.kflex.kubestellar.org controlplanes out of the box so the console hydrates live cluster state instead of defaulting to demo cards. Fixes projectbluefin#193 Assisted-by: github-copilot/gemini-3.8-flash via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
There was a problem hiding this comment.
HUMAN DECISION NEEDED — @mrbobbytables confirm on a real first-boot kiosk that RBAC alone flips the console off demo data; the design doc says console data flows through the local kc-agent hook, not the pod ServiceAccount.
intent-alignment
Issue #193's stated root cause is that the console shows demo cards "until … kc-agent synchronizes active control planes", and docs/superpowers/specs/2026-09-08-kubestellar-kiosk-design.md:60-66 says the console uses its "existing local-agent hook to fetch client-cluster data". This PR only grants server-side SA RBAC (files/k0s/manifests/kubestellar/40-kubestellar-console.yaml:6-42) and sets serviceAccountName (line 78); nothing initializes a control plane or changes DEV_MODE data sourcing. Whether this meets the acceptance criteria ("dashboard shows live cluster metrics on first boot") cannot be verified from the manifest — the new tests only assert strings exist in the YAML, not behavior.
security
Cluster-wide get/list/watch on configmaps (40-kubestellar-console.yaml:15-17) is granted to a console running DEV_MODE=true with auto-login DEV_USER_LOGIN=admin (lines 84-89), reachable through the kiosk proxy. Any kiosk user can now read every ConfigMap in every namespace, which frequently includes sensitive app config. Consider dropping configmaps or scoping it to the namespaces the dashboard actually needs.
style
The RBAC assertions were appended to test_console_provides_local_and_oauth_login_options (tests/unit/test_kubestellar_kiosk.py:83-96), whose name/docstring is about login options. This file's convention is one contract per test — a separate test_console_has_cluster_read_rbac would fit better.
No findings from: correctness, docs-currency.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78
…C test Drop cluster-wide configmaps read access from kubestellar-console ClusterRole to prevent unauthenticated/dev-mode exposure of sensitive configuration in kiosk environments. Move the RBAC assertions into a dedicated unit test test_console_has_cluster_read_rbac. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
|
Addressed review feedback from @kubestellar-hive in commit
🐝 Hive Agent:
|
There was a problem hiding this comment.
HUMAN DECISION NEEDED — @mrbobbytables: confirm the console actually uses its in-cluster ServiceAccount for dashboard data (vs. the client-side kc-agent the kiosk design mandates), and that cluster-wide read via the DEV_MODE auto-login path is acceptable.
intent-alignment
- Issue #193's stated root cause is the console running
DEV_MODE=true/DEV_USER_LOGIN=adminand defaulting to demo cards until akc-agentsyncs. This PR only adds RBAC (files/k0s/manifests/kubestellar/40-kubestellar-console.yaml:6-41) and leaves those env vars untouched (same file,DEV_MODE/ALLOW_DEV_MODE_IN_CLUSTERenv block). The kiosk design spec (docs/superpowers/specs/2026-09-08-kubestellar-kiosk-design.md, "User Flow" / "Security and Failure Behavior") says live data comes from a client-machinekc-agentreading the user's kubeconfig — not from an in-cluster SA. Whether granting the pod RBAC makes console v0.3.34 render live local-cluster data on first boot is unverifiable from this repo and doubtful given that design. - PR body claims read access to
configmaps, but the core-group rule grants onlynodes, namespaces, pods, services, events(40-kubestellar-console.yaml:17-18). Body and diff disagree; one of them should change.
security
- The new ClusterRole/ClusterRoleBinding gives the console SA cluster-wide read of pods, services, events, and workloads (
40-kubestellar-console.yaml:12-41). The same deployment runsDEV_MODE=true+DEV_USER_LOGIN=admin(auto-login, pre-existing), so anyone who can reach the kiosk console now inherits cluster-wide read that the SA previously lacked. Grant is read-only and excludes secrets/configmaps, which is good, but the amplification through the unauthenticated dev-mode path deserves an explicit human sign-off.
docs-currency
- The kiosk design spec's security model (
2026-09-08-kubestellar-kiosk-design.md) documents no in-cluster read grant for the console; if this RBAC model is the intended fix, the spec/operator docs should reflect it. (info)
No findings from: correctness, style.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78
|
Closing as superseded by #210. `files/k0s/manifests/kubestellar/40-kubestellar-console.yaml` is deleted. The console ServiceAccount, ClusterRole and ClusterRoleBinding you added are carried forward into `files/cluster/manifests/console/console.yaml` — the same read access to core resources, apps controllers, `metrics.k8s.io`, and `tenancy.kflex.kubestellar.org` ControlPlanes. Thanks — this was the right diagnosis of #193. |
Summary
Resolves #193 by granting the
kubestellar-consoledeployment dedicated RBAC to discover and query live resources on the local k0s cluster.Changes
ServiceAccount,ClusterRole, andClusterRoleBindinginfiles/k0s/manifests/kubestellar/40-kubestellar-console.yaml.get,list,watch) for core resources (nodes,namespaces,pods,services,events,configmaps),appscontrollers (deployments,statefulsets,daemonsets,replicasets),metrics.k8s.io(nodes,pods), andtenancy.kflex.kubestellar.org(controlplanes).serviceAccountName: kubestellar-consolein the console deployment.tests/unit/test_kubestellar_kiosk.pywith unit contract assertions.— hive: backend=copilot model=gemini-3.8-flash
🐝 Hive Agent:
contributor| SHA:dcbdebe