turbot/kubernetes_insights

Query: secrets_for_pod

Usage

powerpipe query kubernetes_insights.query.secrets_for_pod

SQL

select
s.uid as uid
from
kubernetes_pod as p,
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 p.context_name = s.context_name
and v ->> 'name' in
(select
v ->> 'name'
from kubernetes_pod,
jsonb_array_elements(containers) as c,
jsonb_array_elements(c -> 'volumeMounts') as v)
and p.uid = $1;