turbot/kubernetes_insights

Query: secrets_for_container

Usage

powerpipe query kubernetes_insights.query.secrets_for_container

SQL

select
s.uid as uid
from
kubernetes_pod as p,
jsonb_array_elements(containers) as c,
jsonb_array_elements(c -> 'volumeMounts') as vm,
jsonb_array_elements(volumes) as v
left join kubernetes_secret as s
on v -> 'secret' ->> 'secretName' = s.name
where
s.uid is not null
and v ->> 'name' = vm ->> 'name'
and p.context_name = s.context_name
and concat(c ->> 'name',p.name) = $1;