turbot/kubernetes_insights

Query: persistent_volume_claims_for_container

Usage

powerpipe query kubernetes_insights.query.persistent_volume_claims_for_container

SQL

select
distinct vc.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_persistent_volume_claim as vc
on v -> 'persistentVolumeClaim' ->> 'claimName' = vc.name
where
vc.uid is not null
and v ->> 'name' = vm ->> 'name'
and p.context_name = vc.context_name
and concat(c ->> 'name',p.name) = $1;