turbot/kubernetes_insights

Query: role_bindings_for_service_account

Usage

powerpipe query kubernetes_insights.query.role_bindings_for_service_account

SQL

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