Written for Sariva on EKS. A VM install that observes apps on EKS uses its own AWS identity (for example the EC2 instance role) in place of the pod’s — directly, or to assume the same reader role — and needs the same Kubernetes RBAC. That path is not yet walked end to end.
INFO
This page continues from Wire the pod’s AWS identity (the pod’s home identity). Do that first — the reader role’s trust policy references the pod’s home Pod Identity role.
WARNING
Sariva ships no infrastructure-as-code for this role. The snippets below are reference examples you copy and adapt in whatever tool you use — Terraform, CloudFormation, CDK, Pulumi, or the console. The reader role and its Kubernetes RBAC are resources inside your account and stay customer-authored. Sariva documents what access is needed; it never creates or manages resources in your account.
When you need this
Match your deployment to one of three topologies.
Sariva decides per read: if the entity being read carries a
cross_account_reader_role_arn, the pod calls sts:AssumeRole into it before the CloudWatch / EKS API call; if it does not, the pod uses its home IRSA session unchanged. So you only author a reader role for the accounts that actually differ from the pod’s.
What “reading” means here
The reader role grants read-only access for exactly two things:- CloudWatch Logs Insights — query the app’s
cloudwatch_log_group(and, for the Kafka account, the cluster’skafka_log_groups) to count and sample error-pattern matches. - EKS Kubernetes API —
eks:DescribeCluster+ a presigned-STS bearer token, then a read-onlyGETon pods in the app’s namespace for pod health (phase, restarts, readiness).
1. Set variables
Run these against the target account (the account holding the app workloads / log groups), and fill in the Sariva pod’s home identity.2. Trust policy — let the Sariva pod assume the reader role
The reader role’s trust policy allows only the Sariva pod’s home Pod Identity role to assume it. Author this in the target account.WARNING
sts:TagSession is required, not optional. The Sariva pod gets its credentials from EKS Pod Identity, which stamps transitive session tags onto the pod’s session. STS only lets those tags propagate into the assumed reader session if sts:TagSession is allowed on both this trust policy and the Sariva home role’s identity policy (see Wire the pod’s AWS identity). With sts:AssumeRole alone the assume fails closed with AccessDenied and every cross-account read returns empty.INFO
Confused-deputy protection. The trust policy above already pins the principal to Sariva’s specific home role ARN — assuming the reader role is impossible without holding that exact role, which is account-scoped by construction. Do not add an
sts:ExternalId condition: Sariva does not send an external id on AssumeRole, so a trust policy that requires one would reject every assume and the reads would fail closed.3. Read-only permissions on the reader role
Attach an inline policy granting only the two read paths. CloudWatch Logs Insights has a quirk: onlylogs:StartQuery can be ARN-scoped (with a trailing :*); GetQueryResults / StopQuery / DescribeLogGroups cannot be resource-scoped and must use *.
4. Read-only Kubernetes RBAC on the target EKS
eks:DescribeCluster + the bearer token only gets Sariva to the API server; the Kubernetes RBAC on the target cluster decides what it can read. Sariva reads pods in one namespace — the app’s k8s_namespace — so define the permission set once as a read-only ClusterRole, then scope it to the app’s namespace with a namespaced RoleBinding — the binding keeps the grant namespace-local even though the role object is cluster-scoped. Map the assumed reader role to a Kubernetes group, then bind that group to the ClusterRole via a RoleBinding in the app namespace. In the single-cluster case (Shape A) there is no assumed reader role — the principal is the pod’s home IRSA; map that identity instead, and the same ClusterRole + RoleBinding (including the optional metrics.k8s.io rule for headroom) applies.
4a. ClusterRole + namespaced RoleBinding (read-only on pods)
RoleBinding, even though the ClusterRole object itself is cluster-scoped. Define the ClusterRole once, then add a RoleBinding per app namespace. The second rule (metrics.k8s.io → pods) is optional and powers per-container CPU/mem headroom.
INFO
Headroom needs metrics-server. The
metrics.k8s.io API is served by metrics-server, which is not installed on EKS by default — you add it. If metrics-server is absent or you omit the metrics.k8s.io rule above, pod health (phase / restarts / readiness) still works; only the headroom section degrades to “live usage unavailable” with a reason (metrics-server not installed vs reader role lacks metrics.k8s.io access). Sariva never hard-fails a health check on it. Sariva reads pod metrics only, never node metrics — and the namespaced RoleBinding keeps even the cluster-scoped ClusterRole’s grant confined to the one app namespace.4b. Map the reader role to the sariva-pod-readers group
On a cluster using EKS access entries (recommended):
aws-auth ConfigMap, add an equivalent mapRoles entry mapping the reader role ARN to the sariva-pod-readers group instead.
DANGER
Grant read verbs only (
get / list / watch), and bind with a namespaced RoleBinding so the grant stays scoped to the app namespace — a ClusterRole referenced by a RoleBinding is namespace-local and safe. Sariva never writes to your cluster and never needs cluster-wide access. Never use a ClusterRoleBinding (that grants cluster-wide), and don’t bind the reader group to any role carrying create / update / delete / patch verbs.5. Tell Sariva the reader-role ARN
Record the role ARN on the registration of whatever Sariva reads. Sariva keys the assume-role per target:- App logs + app pod health → set it on the app registration (
cross_account_reader_role_arn), the account where the app runs. - Kafka-side pod health + Kafka log groups → set it on the cluster registration (
cross_account_reader_role_arn), the account where the brokers run.
App teams — on the app registration
App teams set it when registering the app (POST /api/v1/apps/register, or PUT to add it later). Pair it with the app’s aws_region and eks_cluster_name:
Platform/SRE — on the cluster registration
For Kafka-side reads (platform_admin / sre_engineer only), set it on the cluster (POST /api/v1/clusters/register, or PATCH to add it later), alongside aws_account_id, aws_region, eks_cluster_name, and the kafka_log_groups list:
cross_account_reader_role_arn (or leave it null) for a same-account cluster — Sariva uses its home IRSA session.
6. Verify
After the role, RBAC, and registration are in place, ask Sariva to investigate the app, or wait for analert_on_error_pattern / alert_on_pod_restart to fire. A working cross-account read shows up as:
- pod health returning a real phase + restart counts (not
phase=Unknown); - error-pattern investigations returning matched counts + sample log lines.
phase=Unknown or logs come back empty with a reason — check, in order:
Every failure degrades to an empty signal or
phase=Unknown with a reason — never a 500. Sariva keeps serving other apps while you fix the grant.
Per-topology recap
- Shape A — skip this page entirely.
- Shape B — author one reader role in the app account; set
cross_account_reader_role_arnon each app registration there. - Shape C — author one reader role per target account (apps account, Kafka account); set it on the app registrations and the cluster registration respectively.
Continue
Back: wire the pod's AWS identity
The pod’s home Pod Identity role — the principal the reader-role trust policy references.
App teams: logs & pod health
How app-side log scanning and pod health reads work once the reader role is in place.