turbot/kubernetes_insights

Query: node_hierarchy

Usage

powerpipe query kubernetes_insights.query.node_hierarchy

SQL

-- This node
select
null as from_id,
uid as id,
name as title,
0 as depth,
'node' as category
from
kubernetes_node
where
uid = $1 -- Pods associated by the nodes
union all
select
n.uid as from_id,
p.uid as id,
p.name as title,
1 as depth,
'pod' as category
from
kubernetes_node as n
left join kubernetes_pod as p on p.node_name = n.name
where
n.uid = $1 -- containers in Pods owned by the nodes
union all
select
p.uid as from_id,
concat(p.uid, '_', container ->> 'name') as id,
container ->> 'name' as title,
2 as depth,
'container' as category
from
kubernetes_node as n,
kubernetes_pod as p,
jsonb_array_elements(p.containers) as container
where
n.uid = $1
and n.name = p.node_name

Params

ArgsNameDefaultDescriptionVariable
$1uid

    Dashboards

    The query is used in the dashboards: