turbot/kubernetes_insights

Query: deployments_for_service

Usage

powerpipe query kubernetes_insights.query.deployments_for_service

SQL

select
rs_owner ->> 'uid' as uid
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,
kubernetes_service as s
where
s.uid = $1
and s.context_name = rs.context_name
and pod_owner ->> 'uid' = rs.uid
and pod.selector_search = s.selector_query;