turbot/kubernetes_insights

Query: replicaset_tree

Usage

powerpipe query kubernetes_insights.query.replicaset_tree

SQL

-- This replicaset
select
null as from_id,
uid as id,
name as title,
0 as depth,
'job' as category
from
kubernetes_replicaset
where
uid = $1
-- Pods owned by the replicaset
union all
select
pod_owner ->> 'uid' as from_id,
pod.uid as id,
pod.name as title,
1 as depth,
'pod' as category
from
kubernetes_pod as pod,
jsonb_array_elements(pod.owner_references) as pod_owner
where
pod_owner ->> 'uid' = $1
-- containers in Pods owned by the replicaset
union all
select
pod.uid as from_id,
concat(pod.uid, '_', container ->> 'name') as id,
container ->> 'name' as title,
2 as depth,
'container' as category
from
kubernetes_pod as pod,
jsonb_array_elements(pod.owner_references) as pod_owner,
jsonb_array_elements(pod.containers) as container
where
pod_owner ->> 'uid' = $1

Params

ArgsNameDefaultDescriptionVariable
$1uid

    Dashboards

    The query is used in the dashboards: