turbot/kubernetes_insights

Query: service_accounts_for_role

Usage

powerpipe query kubernetes_insights.query.service_accounts_for_role

SQL

select
a.uid as uid
from
kubernetes_service_account as a,
kubernetes_role as r,
kubernetes_role_binding as b,
jsonb_array_elements(subjects) as s
where
b.role_name = r.name
and a.context_name = r.context_name
and s ->> 'kind' = 'ServiceAccount'
and s ->> 'name' = a.name
and r.uid = $1;