opencode agent RBAC applied — follow-ups #55
Labels
No labels
Monitoring
automation
bug
duplicate
feature
forgejo
help wanted
homepage
invalid
k3s
keycloak
ldap
paperclip
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lab/homelab#55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Milestone: Security Hardening
Effort: 1-2 hours
Done (2026-08-30)
The always-on opencode server (LXC ct-253, lab-pve2) no longer uses the
personal cluster-admin kubeconfig. Applied from
manifests/opencode-agent/:Namespaceopencode-agentServiceAccountopencode-agentSecretopencode-agent-token(long-lived SA token via annotation)ClusterRoleBindingopencode-agent-view— cluster-wide read via thebuilt-in
viewrole (no Secrets, Roles, RoleBindings, or nodes)RoleBindingopencode-agent-editinmediaandmonitoring— writeaccess restricted to those namespaces
The LXC's kubeconfig was regenerated with
lxc/opencode/generate-kubeconfig.shand re-provisioned; the old cluster-admin kubeconfig is gone from the LXC.
Verified from inside the LXC:
kubectl get secrets -A-> Forbiddenkubectl get nodes-> Forbidden (view role excludes nodes)kubectl -n media get pods-> workskubectl auth can-i --list-> read-only view verbs onlyOpen follow-ups
Read access to nodes —
viewcannotget/listnodes, which limitsagent debugging (e.g.
kubectl get nodes -o wide). Add a small customClusterRole with
nodesget/list/watch bound to the same SA if wanted.More writable namespaces — copy
manifests/opencode-agent/rolebinding-<ns>-edit.yamlper namespace as theagent earns trust.
auth/,db/,forgejo/,security/,caddy/deliberately excluded for now.
Token rotation — the SA token never expires on its own; rotate by
deleting
opencode-agent-tokenand regenerating the kubeconfig. Considera yearly calendar reminder.
Revoke path — documented in
manifests/opencode-agent/README.md:delete the token Secret, the LXC loses cluster access immediately.
Keep
agent).
lxc/opencode/bootstrap-opencode-lxc.shcomment marked TEMPORARY can beupdated once this issue is closed — the default
KUBECONFIG_SRCswap iscomplete already. Note:
suggestions.mditem 4 was the original backlogentry for this work (file was never tracked in git, so it may be gone).