-
Notifications
You must be signed in to change notification settings - Fork 314
Add read-only service account and namespace-scoped RBAC guides #2110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Avi-Robusta
wants to merge
6
commits into
master
Choose a base branch
from
claude/read-only-service-account-guide-stkig0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a994e20
Add guides for read-only service account and namespace-scoped RBAC
claude 3d7bfe9
Support read-only runner and namespace-scoped Holmes RBAC
Avi-Robusta c4eeb35
docs: add helm upgrade command to namespace-scoping guide
Avi-Robusta d6405fe
docs: use holmes.roleBindingNamespaces for namespace-scoped Holmes RBAC
Avi-Robusta e45a5d9
Delete docs/setup-robusta/rbac-namespace-scoping.rst
Avi-Robusta ca8f039
Update index.rst
Avi-Robusta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,257 @@ | ||
| .. _read-only-service-account: | ||
|
|
||
| Read-Only Service Account | ||
| ======================================== | ||
|
|
||
| By default, Robusta's runner service account has permissions to create, update, and delete Kubernetes resources. This guide explains how to restrict the runner to read-only permissions for environments where you want to prevent any modifications to cluster resources. | ||
|
|
||
| Why Read-Only Mode? | ||
| ------------------- | ||
|
|
||
| Read-only mode is useful in scenarios where you want to: | ||
|
|
||
| - **Prevent accidental modifications**: Ensure that even if a playbook or investigation logic has a bug, no cluster resources will be modified | ||
| - **Comply with security policies**: Meet organizational requirements for read-only access in certain environments | ||
| - **Prevent node operations**: Prevent users from draining or restarting nodes through investigations | ||
| - **Audit-only mode**: Run Holmes for investigation and diagnostics without remediation capabilities | ||
|
|
||
| Limitations of Read-Only Mode | ||
| ----------------------------- | ||
|
|
||
| When using read-only permissions, the following Robusta features will not be available: | ||
|
|
||
| - **Auto-remediation**: Playbooks that automatically fix issues (restart pods, scale deployments, drain nodes, etc.) | ||
| - **Silence management**: Creating or deleting alert silences | ||
| - **Pod debugging**: Live debugging tools that require container execution | ||
| - **Resource modification**: Any playbook or action that modifies Kubernetes resources | ||
|
|
||
| These features require write permissions and will gracefully fail if attempted with read-only service account. | ||
|
|
||
| **Read-only mode is ideal for**: Investigation, diagnostics, log analysis, metric enrichment, and reporting. | ||
|
|
||
| Implementation: Using overrideClusterRoles | ||
| ------------------------------------------- | ||
|
|
||
| Robusta's Helm chart supports the ``runner.overrideClusterRoles`` parameter. When set, the rules you | ||
| provide **fully replace** the built-in runner ClusterRole rules, so only the permissions you list are granted. | ||
|
|
||
| .. note:: | ||
|
|
||
| Do not confuse this with ``runner.customClusterRoleRules``. That parameter *adds* rules on top of the | ||
| built-in rules (which include write verbs), so it **cannot** be used to make the runner read-only. | ||
| Use ``runner.overrideClusterRoles`` for read-only mode. | ||
|
|
||
| To use read-only mode, create a custom values file with the following configuration: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| runner: | ||
| overrideClusterRoles: | ||
| # Core API resources - read-only | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - configmaps | ||
| - daemonsets | ||
| - deployments | ||
| - events | ||
| - namespaces | ||
| - persistentvolumes | ||
| - persistentvolumeclaims | ||
| - pods | ||
| - pods/status | ||
| - pods/log | ||
| - replicasets | ||
| - replicationcontrollers | ||
| - services | ||
| - serviceaccounts | ||
| - endpoints | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # Nodes - read-only | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - nodes | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # Apps API - read-only | ||
| - apiGroups: | ||
| - apps | ||
| resources: | ||
| - daemonsets | ||
| - deployments | ||
| - deployments/scale | ||
| - replicasets | ||
| - replicasets/scale | ||
| - statefulsets | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # Batch API - read-only | ||
| - apiGroups: | ||
| - batch | ||
| resources: | ||
| - cronjobs | ||
| - jobs | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # Autoscaling - read-only | ||
| - apiGroups: | ||
| - autoscaling | ||
| resources: | ||
| - horizontalpodautoscalers | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # RBAC - read-only | ||
| - apiGroups: | ||
| - rbac.authorization.k8s.io | ||
| resources: | ||
| - clusterroles | ||
| - clusterrolebindings | ||
| - roles | ||
| - rolebindings | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # Networking - read-only | ||
| - apiGroups: | ||
| - networking.k8s.io | ||
| resources: | ||
| - ingresses | ||
| - networkpolicies | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # Events - read-only | ||
| - apiGroups: | ||
| - events.k8s.io | ||
| resources: | ||
| - events | ||
| verbs: | ||
| - get | ||
| - list | ||
|
|
||
| # CRDs - read-only | ||
| - apiGroups: | ||
| - apiextensions.k8s.io | ||
| resources: | ||
| - customresourcedefinitions | ||
| verbs: | ||
| - list | ||
| - get | ||
|
|
||
| # API Registration - read-only | ||
| - apiGroups: | ||
| - apiregistration.k8s.io | ||
| resources: | ||
| - apiservices | ||
| verbs: | ||
| - get | ||
| - list | ||
|
|
||
| # Policy - read-only | ||
| - apiGroups: | ||
| - policy | ||
| resources: | ||
| - poddisruptionbudgets | ||
| - podsecuritypolicies | ||
| verbs: | ||
| - get | ||
| - list | ||
|
|
||
| # Monitoring (optional) - read-only | ||
| - apiGroups: | ||
| - monitoring.coreos.com | ||
| resources: | ||
| - prometheusrules | ||
| - servicemonitors | ||
| - podmonitors | ||
| - alertmanagers | ||
| - silences | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| # Argo CD (optional) - read-only | ||
| - apiGroups: | ||
| - argoproj.io | ||
| resources: | ||
| - applications | ||
| - applicationsets | ||
| - appprojects | ||
| - workflows | ||
| - workflowtemplates | ||
| - cronworkflows | ||
| - rollouts | ||
| - analysisruns | ||
| - analysistemplates | ||
| - experiments | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
|
|
||
| Then install or upgrade Robusta with this values file: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| helm upgrade --install robusta robusta/robusta \ | ||
| -f generated_values.yaml \ | ||
| -f read-only-values.yaml \ | ||
| -n robusta-system --create-namespace | ||
|
|
||
| Verifying Read-Only Permissions | ||
| -------------------------------- | ||
|
|
||
| After installation, verify that the runner service account has only read permissions. The ClusterRole is | ||
| cluster-scoped, so no namespace flag is needed: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| # Inspect the ClusterRole - the rules should only contain "get", "list", "watch" verbs, | ||
| # and NOT "create", "delete", "patch", or "update". | ||
| kubectl describe clusterrole robusta-runner-cluster-role | ||
|
|
||
| Testing Write Protection | ||
| ------------------------ | ||
|
|
||
| Use ``kubectl auth can-i`` to confirm what the runner service account can and cannot do | ||
| (replace ``robusta-system`` with your release namespace): | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| SA=system:serviceaccount:robusta-system:robusta-runner-service-account | ||
|
|
||
| kubectl auth can-i list pods --as=$SA -n default # -> yes | ||
| kubectl auth can-i delete pods --as=$SA -n default # -> no | ||
| kubectl auth can-i patch deployments --as=$SA -n default # -> no | ||
| kubectl auth can-i create pods/exec --as=$SA -n default # -> no | ||
|
|
||
| The read verbs should return ``yes`` while all write/exec verbs return ``no``, confirming the runner is read-only. | ||
|
|
||
| Notes and Recommendations | ||
| -------------------------- | ||
|
|
||
| - **CRD Permissions**: If you have custom operators (Argo, Flux, Kafka, KEDA, etc.), add their CRD groups to the read-only rules above with only ``get``, ``list``, ``watch`` verbs | ||
| - **Performance**: Read-only mode may improve performance slightly since no write operations are performed | ||
| - **Logging**: Monitor Robusta logs for any "permission denied" errors to identify features that require write access | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.