Table: kubernetes_node - Query Kubernetes Nodes using SQL
Kubernetes Nodes are the worker machines that run containerized applications and other workloads. Nodes include the necessary services to run Pods (the smallest and simplest unit in the Kubernetes object model that you create or deploy) and are managed by the master components. The services on a node include the container runtime, kubelet and kube-proxy.
Table Usage Guide
The kubernetes_node
table provides insights into the Nodes within Kubernetes. As a DevOps engineer, explore node-specific details through this table, including its status, capacity, and allocatable resources. Utilize it to uncover information about nodes, such as the number of pods that can be scheduled for execution on the Node, the amount of CPU and memory resources available, and the overall status of the Node.
Examples
Basic Info
Assess the elements within your Kubernetes nodes to gain insights into their creation time, capacity, and associated addresses. This query is beneficial for understanding your nodes' infrastructure and helps in efficient resource allocation and management.
select name, pod_cidr, pod_cidrs, provider_id, creation_timestamp, addresses, capacityfrom kubernetes_node;
select name, pod_cidr, pod_cidrs, provider_id, creation_timestamp, addresses, capacityfrom kubernetes_node;
List conditions for node
This example demonstrates how to analyze the status and conditions of nodes within a Kubernetes system. It's useful for maintaining system health and troubleshooting, as it enables users to track node conditions over time and identify potential issues based on changes in status or the occurrence of specific conditions.
select name, cond ->> 'type' as type, lower(cond ->> 'status') :: bool as status, (cond ->> 'lastHeartbeatTime') :: timestamp as last_heartbeat_time, (cond ->> 'lastTransitionTime') :: timestamp as last_transition_time, cond ->> 'reason' as reason, cond ->> 'message' as messagefrom kubernetes_node, jsonb_array_elements(conditions) as condorder by name, status desc;
select name, json_extract(cond.value, '$.type') as type, lower(json_extract(cond.value, '$.status')) = 'true' as status, datetime(json_extract(cond.value, '$.lastHeartbeatTime')) as last_heartbeat_time, datetime(json_extract(cond.value, '$.lastTransitionTime')) as last_transition_time, json_extract(cond.value, '$.reason') as reason, json_extract(cond.value, '$.message') as messagefrom kubernetes_node, json_each(conditions) as condorder by name, status desc;
Get system info for nodes
Explore the system information for specific nodes to gain insights into machine specifications, operating system details, and various versions of installed software. This could be beneficial for troubleshooting, system audits, or understanding the overall system configuration.
select name, node_info ->> 'machineID' as machine_id, node_info ->> 'systemUUID' as systemUUID, node_info ->> 'bootID' as bootID, node_info ->> 'kernelVersion' as kernelVersion, node_info ->> 'osImage' as osImage, node_info ->> 'operatingSystem' as operatingSystem, node_info ->> 'architecture' as architecture, node_info ->> 'containerRuntimeVersion' as containerRuntimeVersion, node_info ->> 'kubeletVersion' as kubeletVersion, node_info ->> 'kubeProxyVersion' as kubeProxyVersionfrom kubernetes_node;
select name, json_extract(node_info, '$.machineID') as machine_id, json_extract(node_info, '$.systemUUID') as systemUUID, json_extract(node_info, '$.bootID') as bootID, json_extract(node_info, '$.kernelVersion') as kernelVersion, json_extract(node_info, '$.osImage') as osImage, json_extract(node_info, '$.operatingSystem') as operatingSystem, json_extract(node_info, '$.architecture') as architecture, json_extract(node_info, '$.containerRuntimeVersion') as containerRuntimeVersion, json_extract(node_info, '$.kubeletVersion') as kubeletVersion, json_extract(node_info, '$.kubeProxyVersion') as kubeProxyVersionfrom kubernetes_node;
Node IP info
Gain insights into the distribution of internal and external IP addresses, as well as hostnames and internal DNS, across your Kubernetes nodes. This can help in managing network configurations and troubleshooting connectivity issues.
select name, jsonb_path_query_array( addresses, '$[*] ? (@.type == "ExternalIP").address' ) as public_ips, jsonb_path_query_array( addresses, '$[*] ? (@.type == "InternalIP").address' ) as internal_ips, jsonb_path_query_array( addresses, '$[*] ? (@.type == "InternalDNS").address' ) as internal_dns, jsonb_path_query_array( addresses, '$[*] ? (@.type == "Hostname").address' ) as hostnamesfrom kubernetes_node;
Error: The corresponding SQLite query is unavailable.
List manifest resources
Explore which Kubernetes nodes have a specified path, providing insights into the distribution of resources across your infrastructure. This can help optimize resource allocation and ensure balanced workload distribution.
select name, pod_cidr, pod_cidrs, provider_id, addresses, capacity, pathfrom kubernetes_nodewhere path is not null;
select name, pod_cidr, pod_cidrs, provider_id, addresses, capacity, pathfrom kubernetes_nodewhere path is not null;
Query examples
- cluster_node_count
- cluster_nodes_count
- cluster_nodes_table
- clusters_for_node
- endpoints_for_node
- node_1_year_count
- node_24_hours_count
- node_30_90_days_count
- node_30_days_count
- node_90_365_days_count
- node_addresses
- node_age_table
- node_allocatable
- node_annotations
- node_by_context
- node_capacity
- node_containers_count
- node_count
- node_hierarchy
- node_input
- node_labels
- node_overview
- node_pod_details
- node_pods_count
- node_table
- nodes_for_cluster
- nodes_for_cronjob
- nodes_for_daemonset
- nodes_for_deployment
- nodes_for_job
- nodes_for_replicaset
- nodes_for_statefulset
- pod_configuration
- pods_for_node
- volumes_for_node
Schema for kubernetes_node
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
addresses | jsonb | Endpoints of daemons running on the Node. | |
allocatable | jsonb | Allocatable represents the resources of a node that are available for scheduling. Defaults to capacity. | |
annotations | jsonb | Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. | |
capacity | jsonb | Capacity represents the total resources of a node. | |
conditions | jsonb | List of current observed node conditions. | |
config | jsonb | Status of the config assigned to the node via the dynamic Kubelet config feature. | |
config_source | jsonb | The source to get node configuration from. | |
context_name | text | Kubectl config context name. | |
creation_timestamp | timestamp with time zone | CreationTimestamp is a timestamp representing the server time when this object was created. | |
daemon_endpoints | jsonb | Set of ids/uuids to uniquely identify the node. | |
deletion_grace_period_seconds | bigint | Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. | |
deletion_timestamp | timestamp with time zone | DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. | |
end_line | bigint | The path to the manifest file. | |
finalizers | jsonb | Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. | |
generate_name | text | GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. | |
generation | bigint | A sequence number representing a specific generation of the desired state. | |
images | jsonb | List of container images on this node. | |
labels | jsonb | Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. | |
name | text | Name of the object. Name must be unique within a namespace. | |
node_info | jsonb | List of container images on this node. | |
owner_references | jsonb | List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. | |
path | text | The path to the manifest file. | |
phase | text | The recently observed lifecycle phase of the node. | |
pod_cidr | cidr | Pod IP range assigned to the node. | |
pod_cidrs | jsonb | List of the IP ranges assigned to the node for usage by Pods. | |
provider_id | text | ID of the node assigned by the cloud provider in the format: <ProviderName>://<ProviderSpecificNodeID>. | |
resource_version | text | An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. | |
source_type | text | The source of the resource. Possible values are: deployed and manifest. If the resource is fetched from the spec file the value will be manifest. | |
sp_connection_name | text | Steampipe connection name. | |
sp_ctx | jsonb | Steampipe context in JSON form. | |
start_line | bigint | The path to the manifest file. | |
tags | jsonb | A map of tags for the resource. This includes both labels and annotations. | |
taints | jsonb | List of the taints attached to the node to has the "effect" on pod that does not tolerate the Taint | |
title | text | Title of the resource. | |
uid | text | UID is the unique in time and space value for this object. | |
unschedulable | boolean | Unschedulable controls node schedulability of new pods. By default, node is schedulable. | |
volumes_attached | jsonb | List of volumes that are attached to the node. | |
volumes_in_use | jsonb | List of attachable volumes in use (mounted) by the node. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- kubernetes
You can pass the configuration to the command with the --config
argument:
steampipe_export_kubernetes --config '<your_config>' kubernetes_node