turbot/kubernetes_insights

Query: containers_for_deployment

Usage

powerpipe query kubernetes_insights.query.containers_for_deployment

SQL

select
container ->> 'name' || pod.name as name
from
kubernetes_replicaset as rs,
jsonb_array_elements(rs.owner_references) as rs_owner,
kubernetes_pod as pod,
jsonb_array_elements(pod.owner_references) as pod_owner,
jsonb_array_elements(pod.containers) as container
where
rs_owner ->> 'uid' = $1
and rs.context_name = pod.context_name
and pod_owner ->> 'uid' = rs.uid;