Skip to content

Kubernetes

A live Kubernetes cluster's pods, nodes, workloads, events, RBAC, logs and custom resources as SQL

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/kubernetes/index.md to help me query Kubernetes with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Check pod security settings across namespaces

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT name, phase, labels['pod-security.kubernetes.io/enforce'] AS enforce
FROM kubernetes.main.namespaces
ORDER BY name

Quick start

Choose where to run Kubernetes, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'kubernetes' AS kubernetes (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-kubernetes'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

kubernetes credentials

How to reach a Kubernetes API server: a kubeconfig (with an optional context) or a server URL with a bearer token or client certificate. Read-only access (get/list/watch) is all the worker needs.

Get these credentials →
secret.sql
CREATE SECRET kubernetes (
    TYPE kubernetes,
    kubeconfig                 '<KUBERNETES_KUBECONFIG>',  -- secret
    context                    '<context>',
    server                     '<server>',
    token                      '<KUBERNETES_TOKEN>',  -- secret
    certificate_authority_data '<certificate_authority_data>',
    client_certificate_data    '<client_certificate_data>',
    client_key_data            '<KUBERNETES_CLIENT_KEY_DATA>',  -- secret
    tls_server_name            '<tls_server_name>',
    insecure_skip_tls_verify   '<insecure_skip_tls_verify>'
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT name, phase, labels['pod-security.kubernetes.io/enforce'] AS enforce
FROM kubernetes.main.namespaces
ORDER BY name
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'kubernetes' AS kubernetes (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

A live Kubernetes cluster's API as SQL: pods, nodes, workloads, services, events, RBAC, storage, logs, metrics and custom resources, read-only.

ATTACH options

use_local_kubeconfig
Opt in to reading the local kubeconfig ($KUBECONFIG, else ~/.kube/config) when no kubernetes secret is set. Off by default: the worker never reads local credentials unless this is true.BOOLEAN
context
Kubeconfig context to use (the local kubeconfig's or the secret's KUBECONFIG); overrides the secret's CONTEXT. Default the current-context.VARCHAR
secret
Name of the kubernetes secret to use when several exist (one ATTACH per cluster); default the unscoped kubernetes secret.VARCHAR
resource_tables
Comma-separated API resources to expose as tables in schema `resources`, each `group/version/resource` (e.g. `stable.example.com/v1/crontabs`, `v1/pods`), or `all` to expose every listable resource found by discovery (needs use_local_kubeconfig, since secrets are not available at ATTACH time). Each table has the metadata columns plus spec, status and object as JSON.VARCHAR
configmap_values
true to fill configmaps.data with the ConfigMap values; default false, which lists only the keys. Secret values are never returned.BOOLEAN
page_size
Objects requested per list page (limit=), 1 to 5000; default 500. Pages are fetched lazily with the API's continue token.BIGINT

Catalog

Everything kubernetes exposes once attached — read straight from the worker's released build.

kubernetes 1 schema
main 33 tables · 3 functions

Core Kubernetes objects, pod logs, metrics and API discovery, read live from the API server.

Schema examples (35)
Examples (35)

Namespaces with their pod security enforcement level

SELECT name, phase, labels['pod-security.kubernetes.io/enforce'] AS enforce
FROM kubernetes.main.namespaces
ORDER BY name;

Allocatable CPU cores and memory GiB per ready node

SELECT name, allocatable_cpu_millicores / 1000.0 AS cpu_cores,
  allocatable_memory_bytes / 2^30 AS memory_gib
FROM kubernetes.main.nodes
WHERE ready
ORDER BY name;

Pods not running or succeeded, with their reason

SELECT namespace, name, phase, reason
FROM kubernetes.main.pods
WHERE phase NOT IN ('Running', 'Succeeded')
ORDER BY namespace, name;

Containers that were OOM-killed last time they stopped

SELECT namespace, pod_name, container_name, restart_count
FROM kubernetes.main.pod_containers
WHERE last_termination_reason = 'OOMKilled'
ORDER BY restart_count DESC;
31 more examples

Deployments with fewer ready replicas than desired

SELECT namespace, name, replicas, ready_replicas
FROM kubernetes.main.deployments
WHERE coalesce(ready_replicas, 0) < replicas
ORDER BY namespace, name;

Old, scaled-down ReplicaSets kept per deployment

SELECT namespace, owner_references[1].name AS deployment,
  count(*) AS old_replicasets
FROM kubernetes.main.replicasets
WHERE replicas = 0
GROUP BY ALL
ORDER BY old_replicasets DESC;

StatefulSets mid-rollout

SELECT namespace, name, current_revision, update_revision
FROM kubernetes.main.statefulsets
WHERE current_revision <> update_revision
ORDER BY namespace, name;

DaemonSets not ready on every node

SELECT namespace, name, desired_number_scheduled, number_ready
FROM kubernetes.main.daemonsets
WHERE number_ready < desired_number_scheduled
ORDER BY namespace, name;

Failed jobs in the last day

SELECT namespace, name, failed, start_time
FROM kubernetes.main.jobs
WHERE status = 'Failed' AND start_time > now() - INTERVAL 1 DAY
ORDER BY start_time DESC;

CronJobs whose last scheduled run did not succeed

SELECT namespace, name, schedule, last_schedule_time, last_successful_time
FROM kubernetes.main.cronjobs
WHERE last_successful_time IS NULL OR last_successful_time < last_schedule_time
ORDER BY namespace, name;

Autoscalers pinned at their maximum

SELECT namespace, name, target_kind, target_name, max_replicas
FROM kubernetes.main.horizontalpodautoscalers
WHERE current_replicas >= max_replicas
ORDER BY namespace, name;

LoadBalancer services and their external addresses

SELECT namespace, name, load_balancer_ingress
FROM kubernetes.main.services
WHERE type = 'LoadBalancer'
ORDER BY namespace, name;

Ready and total endpoints per service

SELECT namespace, service_name, sum(ready_count) AS ready,
  sum(endpoint_count) AS total
FROM kubernetes.main.endpointslices
GROUP BY ALL
ORDER BY namespace, service_name;

Every routed host and path with its backend service

SELECT namespace, name, r.host, r.path, r.service_name, r.service_port
FROM kubernetes.main.ingresses,
     UNNEST(rules) AS u(r)
ORDER BY r.host, r.path;

Namespaces with a default-deny ingress policy

SELECT DISTINCT namespace
FROM kubernetes.main.networkpolicies
WHERE default_deny_ingress
ORDER BY namespace;

ConfigMaps and how many keys each holds

SELECT namespace, name, len(keys) AS key_count
FROM kubernetes.main.configmaps
ORDER BY key_count DESC, namespace, name;

Secrets by type

SELECT type, count(*) AS secrets
FROM kubernetes.main.secrets
GROUP BY type
ORDER BY secrets DESC;

Service accounts that do not opt out of token automount

SELECT namespace, name
FROM kubernetes.main.serviceaccounts
WHERE automount_service_account_token IS DISTINCT FROM false
ORDER BY namespace, name;

Released or failed volumes still holding storage

SELECT name, phase, capacity_bytes / 2^30 AS gib, claim_namespace,
  claim_name
FROM kubernetes.main.persistentvolumes
WHERE phase IN ('Released', 'Failed')
ORDER BY gib DESC;

Requested storage per storage class, in GiB

SELECT storage_class, sum(requested_bytes) / 2^30 AS gib
FROM kubernetes.main.persistentvolumeclaims
GROUP BY storage_class
ORDER BY gib DESC;

The default storage class

SELECT name, provisioner, volume_binding_mode
FROM kubernetes.main.storageclasses
WHERE is_default
ORDER BY name;

Priority classes from highest to lowest

SELECT name, value, preemption_policy
FROM kubernetes.main.priorityclasses
ORDER BY value DESC;

Roles with the most rules

SELECT namespace, name, len(rules) AS rule_count
FROM kubernetes.main.roles
ORDER BY rule_count DESC, namespace, name;

Cluster roles that grant every verb on every resource

SELECT name
FROM kubernetes.main.clusterroles,
     UNNEST(rules) AS u(r)
WHERE list_contains(r.verbs, '*') AND list_contains(r.resources, '*')
ORDER BY name;

Bindings that grant cluster-admin inside a namespace

SELECT namespace, name, subjects
FROM kubernetes.main.rolebindings
WHERE role_name = 'cluster-admin'
ORDER BY namespace, name;

Who is bound to cluster-admin

SELECT name, s.kind, s.name AS subject
FROM kubernetes.main.clusterrolebindings,
     UNNEST(subjects) AS u(s)
WHERE role_name = 'cluster-admin'
ORDER BY name;

Roles and cluster roles that can read secrets

SELECT role_kind, namespace, role_name
FROM kubernetes.main.rbac_rules
WHERE resource IN ('secrets', '*') AND verb IN ('get', 'list', 'watch', '*') AND api_group IN ('', '*')
GROUP BY ALL
ORDER BY ALL;

Roles granted to one service account

SELECT binding_kind, namespace, binding_name, role_kind, role_name
FROM kubernetes.main.rbac_subjects
WHERE subject_kind = 'ServiceAccount' AND subject_namespace = 'kube-system' AND subject_name = 'default'
ORDER BY ALL;

Most frequent warning reasons

SELECT reason, sum(count) AS occurrences
FROM kubernetes.main.events
WHERE type = 'Warning'
GROUP BY reason
ORDER BY occurrences DESC;

Node CPU and memory utilisation against allocatable

SELECT n.name,
  m.cpu_usage_millicores / n.allocatable_cpu_millicores AS cpu_util,
  m.memory_usage_bytes / n.allocatable_memory_bytes AS mem_util
FROM kubernetes.main.node_metrics m
JOIN kubernetes.main.nodes n ON n.name = m.node_name
ORDER BY cpu_util DESC;

Containers using more memory than they request

SELECT m.namespace, m.pod_name, m.container_name, m.memory_usage_bytes,
  c.memory_request_bytes
FROM kubernetes.main.pod_metrics m
JOIN kubernetes.main.pod_containers c USING (namespace, pod_name, container_name)
WHERE m.memory_usage_bytes > c.memory_request_bytes
ORDER BY m.memory_usage_bytes DESC;

Custom resource types (dotted groups outside *.k8s.io)

SELECT api_version, resource, kind
FROM kubernetes.main.api_resources
WHERE preferred AND "group" LIKE '%.%' AND "group" NOT LIKE '%k8s.io'
ORDER BY ALL;

Kubernetes version of the cluster

SELECT git_version, platform FROM kubernetes.main.api_servers;

PodDisruptionBudgets and how many disruptions they allow

SELECT namespace, name, (status->>'disruptionsAllowed')::INT AS allowed
FROM kubernetes.main.resources('policy/v1', 'poddisruptionbudgets')
ORDER BY allowed, namespace, name;

Last 50 lines of a pod's logs

SELECT timestamp, container, message
FROM kubernetes.main.pod_logs('default', 'web-0', tail_lines := 50)
ORDER BY timestamp;
Tables
api_resources 1 example14 cols

Every API resource the cluster serves (like kubectl api-resources), custom resources included

Columns
group VARCHAR
API group ('' for the core group).
version VARCHAR
API version within the group, e.g. v1.
api_versionnot null VARCHAR
group/version, or v1 for the core group: the first argument of resources().
resourcenot null VARCHAR
Plural resource name, e.g. deployments: the second argument of resources().
kind VARCHAR
Object kind, e.g. Deployment.
singular_name VARCHAR
Singular resource name.
namespaced BOOLEAN
Whether objects live in namespaces.
preferred BOOLEAN
Whether this is the group's preferred version.
listable BOOLEAN
Whether the list verb is supported (resources() needs it).
verbs VARCHAR[]
Supported verbs.
short_names VARCHAR[]
kubectl short names, e.g. po, deploy.
categories VARCHAR[]
Categories, e.g. all.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (api_version, resource)
Example

Custom resource types (dotted groups outside *.k8s.io)

SELECT api_version, resource, kind
FROM kubernetes.main.api_resources
WHERE preferred AND "group" LIKE '%.%' AND "group" NOT LIKE '%k8s.io'
ORDER BY ALL;
Link
api_servers 1 example9 cols

The API server the worker connects to and its version (GET /version), one row

Columns
git_version VARCHAR
e.g. v1.31.2.
major VARCHAR
Major version.
minor VARCHAR
Minor version.
platform VARCHAR
e.g. linux/amd64.
go_version VARCHAR
Go version the server was built with.
build_date TIMESTAMP WITH TIME ZONE
When the API server binary was built.
servernot null VARCHAR
API server URL the worker connected to.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (server)
Example

Kubernetes version of the cluster

SELECT git_version, platform FROM kubernetes.main.api_servers;
Link
clusterrolebindings 1 example11 cols

ClusterRoleBindings: which ClusterRole is granted cluster-wide to which subjects

Columns
name VARCHAR
Name of the ClusterRoleBinding (metadata.name).
uidnot null VARCHAR
Unique id of the ClusterRoleBinding (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the ClusterRoleBinding was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
role_kind VARCHAR
Always ClusterRole.
role_name VARCHAR
Name of the granted ClusterRole.
subjects STRUCT of 4 fields[]
Subjects: kind (User, Group, ServiceAccount), name, namespace, api_group.
STRUCT[] 4 fields
  • kindVARCHAR
  • nameVARCHAR
  • namespaceVARCHAR
  • api_groupVARCHAR
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Who is bound to cluster-admin

SELECT name, s.kind, s.name AS subject
FROM kubernetes.main.clusterrolebindings,
     UNNEST(subjects) AS u(s)
WHERE role_name = 'cluster-admin'
ORDER BY name;
Link
clusterroles 1 example11 cols

ClusterRoles with their rules and aggregation selectors

Columns
name VARCHAR
Name of the ClusterRole (metadata.name).
uidnot null VARCHAR
Unique id of the ClusterRole (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the ClusterRole was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
rules STRUCT of 5 fields[]
Rules: api_groups ('' = core), resources (with subresources such as pods/exec), resource_names, verbs, non_resource_urls.
STRUCT[] 5 fields
  • api_groupsVARCHAR[]
  • resourcesVARCHAR[]
  • resource_namesVARCHAR[]
  • verbsVARCHAR[]
  • non_resource_urlsVARCHAR[]
aggregated BOOLEAN
Whether the rules are aggregated from other ClusterRoles (aggregationRule).
aggregation_selectors VARCHAR[]
Label selectors of the aggregationRule, kubectl syntax.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Cluster roles that grant every verb on every resource

SELECT name
FROM kubernetes.main.clusterroles,
     UNNEST(rules) AS u(r)
WHERE list_contains(r.verbs, '*') AND list_contains(r.resources, '*')
ORDER BY name;
Link
configmaps 1 example13 cols

ConfigMaps with their keys; values only when the ATTACH sets configmap_values true

Columns
namespace VARCHAR
Namespace of the ConfigMap.
name VARCHAR
Name of the ConfigMap (metadata.name).
uidnot null VARCHAR
Unique id of the ConfigMap (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the ConfigMap was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
keys VARCHAR[]
Keys of data and binaryData, sorted.
binary_keys VARCHAR[]
Keys of binaryData only.
immutable BOOLEAN
Whether the ConfigMap is immutable.
data MAP(VARCHAR, VARCHAR)
data values; NULL unless the ATTACH sets configmap_values true.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

ConfigMaps and how many keys each holds

SELECT namespace, name, len(keys) AS key_count
FROM kubernetes.main.configmaps
ORDER BY key_count DESC, namespace, name;
Link
cronjobs 1 example21 cols

CronJobs with schedule, time zone, suspension, concurrency policy and last runs

Columns
namespace VARCHAR
Namespace of the CronJob.
name VARCHAR
Name of the CronJob (metadata.name).
uidnot null VARCHAR
Unique id of the CronJob (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the CronJob was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
schedule VARCHAR
Cron schedule, e.g. */5 * * * *.
time_zone VARCHAR
IANA time zone of the schedule (NULL = controller's).
suspend BOOLEAN
Whether new runs are suspended.
concurrency_policy VARCHAR
Allow, Forbid or Replace.
starting_deadline_seconds BIGINT
Seconds after a missed schedule time within which the run may still start.
successful_jobs_history_limit BIGINT
Count of completed jobs kept.
failed_jobs_history_limit BIGINT
Count of failed jobs kept.
last_schedule_time TIMESTAMP WITH TIME ZONE
When a job was last scheduled.
last_successful_time TIMESTAMP WITH TIME ZONE
When a job last completed successfully.
active_jobs VARCHAR[]
Names of running jobs.
images VARCHAR[]
Distinct container images of the pod template.
containers STRUCT of 9 fields[]
Containers of the pod template: name, kind (init, sidecar or app), image, cpu_request_millicores, cpu_limit_millicores, memory_request_bytes, memory_limit_bytes, ports (container ports), command.
STRUCT[] 9 fields
  • nameVARCHAR
  • kindVARCHAR
  • imageVARCHAR
  • cpu_request_millicoresBIGINT
  • cpu_limit_millicoresBIGINT
  • memory_request_bytesBIGINT
  • memory_limit_bytesBIGINT
  • portsBIGINT[]
  • commandVARCHAR[]
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

CronJobs whose last scheduled run did not succeed

SELECT namespace, name, schedule, last_schedule_time, last_successful_time
FROM kubernetes.main.cronjobs
WHERE last_successful_time IS NULL OR last_successful_time < last_schedule_time
ORDER BY namespace, name;
Link
daemonsets 1 example21 cols

DaemonSets with desired, scheduled, ready, available and misscheduled pod counts

Columns
namespace VARCHAR
Namespace of the DaemonSet.
name VARCHAR
Name of the DaemonSet (metadata.name).
uidnot null VARCHAR
Unique id of the DaemonSet (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the DaemonSet was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
desired_number_scheduled BIGINT
Count of nodes that should run the pod.
current_number_scheduled BIGINT
Count of nodes running at least one pod.
number_ready BIGINT
Count of nodes with a ready pod.
number_available BIGINT
Count of nodes with an available pod.
number_unavailable BIGINT
Count of nodes without an available pod.
number_misscheduled BIGINT
Count of nodes running the pod that should not.
updated_number_scheduled BIGINT
Count of nodes running the updated pod.
update_strategy VARCHAR
RollingUpdate or OnDelete.
node_selector MAP(VARCHAR, VARCHAR)
Pod template nodeSelector.
selector VARCHAR
Pod label selector in kubectl syntax.
images VARCHAR[]
Distinct container images of the pod template.
containers STRUCT of 9 fields[]
Containers of the pod template: name, kind (init, sidecar or app), image, cpu_request_millicores, cpu_limit_millicores, memory_request_bytes, memory_limit_bytes, ports (container ports), command.
STRUCT[] 9 fields
  • nameVARCHAR
  • kindVARCHAR
  • imageVARCHAR
  • cpu_request_millicoresBIGINT
  • cpu_limit_millicoresBIGINT
  • memory_request_bytesBIGINT
  • memory_limit_bytesBIGINT
  • portsBIGINT[]
  • commandVARCHAR[]
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

DaemonSets not ready on every node

SELECT namespace, name, desired_number_scheduled, number_ready
FROM kubernetes.main.daemonsets
WHERE number_ready < desired_number_scheduled
ORDER BY namespace, name;
Link
deployments 2 examples29 cols

Deployments with desired, ready, available and updated replicas, strategy, images and conditions

Columns
namespace VARCHAR
Namespace of the Deployment.
name VARCHAR
Name of the Deployment (metadata.name).
uidnot null VARCHAR
Unique id of the Deployment (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Deployment was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
replicas BIGINT
Desired count of pods (spec.replicas).
ready_replicas BIGINT
Count of pods passing readiness.
available_replicas BIGINT
Count of pods available for at least minReadySeconds.
updated_replicas BIGINT
Count of pods running the latest template.
unavailable_replicas BIGINT
Count of pods still needed for full availability.
available BOOLEAN
Whether the Available condition is True.
progressing BOOLEAN
Whether the Progressing condition is True.
paused BOOLEAN
Whether the rollout is paused.
strategy VARCHAR
RollingUpdate or Recreate.
max_surge VARCHAR
Rolling update maxSurge (number or percent).
max_unavailable VARCHAR
Rolling update maxUnavailable (number or percent).
min_ready_seconds BIGINT
Seconds a new pod must be ready before it counts as available.
revision VARCHAR
Current rollout revision (deployment.kubernetes.io/revision).
generation BIGINT
Spec revision counter (metadata.generation), incremented on every spec change.
observed_generation BIGINT
Spec revision number (integer counter) the controller last acted on; below generation = rollout pending.
selector VARCHAR
Pod label selector in kubectl syntax.
service_account VARCHAR
ServiceAccount of the pod template.
images VARCHAR[]
Distinct container images of the pod template.
containers STRUCT of 9 fields[]
Containers of the pod template: name, kind (init, sidecar or app), image, cpu_request_millicores, cpu_limit_millicores, memory_request_bytes, memory_limit_bytes, ports (container ports), command.
STRUCT[] 9 fields
  • nameVARCHAR
  • kindVARCHAR
  • imageVARCHAR
  • cpu_request_millicoresBIGINT
  • cpu_limit_millicoresBIGINT
  • memory_request_bytesBIGINT
  • memory_limit_bytesBIGINT
  • portsBIGINT[]
  • commandVARCHAR[]
conditions STRUCT of 5 fields[]
Status conditions: type, status (True/False/Unknown), reason, message, last_transition_time.
STRUCT[] 5 fields
  • typeVARCHAR
  • statusVARCHAR
  • reasonVARCHAR
  • messageVARCHAR
  • last_transition_timeTIMESTAMP WITH TIME ZONE
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (2)

Deployments with fewer ready replicas than desired

SELECT namespace, name, replicas, ready_replicas
FROM kubernetes.main.deployments
WHERE coalesce(ready_replicas, 0) < replicas
ORDER BY namespace, name;

Images deployed per namespace

SELECT namespace, image, count(*) AS deployments
FROM kubernetes.main.deployments,
     UNNEST(images) AS u(image)
GROUP BY ALL
ORDER BY namespace, image;
Link
endpointslices 1 example15 cols

EndpointSlices: the backend addresses of each service, with readiness and the pod behind each

Columns
namespace VARCHAR
Namespace of the EndpointSlice.
name VARCHAR
Name of the EndpointSlice (metadata.name).
uidnot null VARCHAR
Unique id of the EndpointSlice (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the EndpointSlice was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
service_name VARCHAR
Service the slice belongs to (kubernetes.io/service-name label).
address_type VARCHAR
IPv4, IPv6 or FQDN.
endpoint_count BIGINT
Count of endpoints in the slice.
ready_count BIGINT
Count of endpoints whose ready condition is true.
endpoints STRUCT of 10 fields[]
Endpoints: addresses, ready, serving, terminating, hostname, node_name, zone, target_kind, target_namespace, target_name.
STRUCT[] 10 fields
  • addressesVARCHAR[]
  • readyBOOLEAN
  • servingBOOLEAN
  • terminatingBOOLEAN
  • hostnameVARCHAR
  • node_nameVARCHAR
  • zoneVARCHAR
  • target_kindVARCHAR
  • target_namespaceVARCHAR
  • target_nameVARCHAR
ports STRUCT of 4 fields[]
Ports: name, protocol, port (TCP/UDP port number), app_protocol.
STRUCT[] 4 fields
  • nameVARCHAR
  • protocolVARCHAR
  • portBIGINT
  • app_protocolVARCHAR
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Ready and total endpoints per service

SELECT namespace, service_name, sum(ready_count) AS ready,
  sum(endpoint_count) AS total
FROM kubernetes.main.endpointslices
GROUP BY ALL
ORDER BY namespace, service_name;
Link
events 2 examples21 cols

Events: what happened to which object, when, how often and why

Columns
namespace VARCHAR
Namespace of the event.
name VARCHAR
Event object name.
uidnot null VARCHAR
Event object uid.
type VARCHAR
Normal or Warning.
reason VARCHAR
Short machine-readable reason, e.g. BackOff, FailedScheduling, Pulled, Killing.
message VARCHAR
Human-readable description.
count BIGINT
Count of occurrences (series count for new-style events).
involved_kind VARCHAR
Kind of the object the event is about.
involved_namespace VARCHAR
Namespace of that object.
involved_name VARCHAR
Name of that object.
involved_uid VARCHAR
UID of that object.
involved_field_path VARCHAR
Part of the object, e.g. spec.containers{web}.
source_component VARCHAR
Reporting component, e.g. kubelet, default-scheduler.
source_host VARCHAR
Node that reported it.
first_timestamp TIMESTAMP WITH TIME ZONE
First occurrence (older events API).
last_timestamp TIMESTAMP WITH TIME ZONE
Latest occurrence (older events API).
event_time TIMESTAMP WITH TIME ZONE
Time of the first observation (events.k8s.io).
last_seen TIMESTAMP WITH TIME ZONE
Latest of last_timestamp, series last observed time, event_time and creation time.
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Event object was created.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (2)

Most frequent warning reasons

SELECT reason, sum(count) AS occurrences
FROM kubernetes.main.events
WHERE type = 'Warning'
GROUP BY reason
ORDER BY occurrences DESC;

Recent events for one pod

SELECT last_seen, type, reason, message
FROM kubernetes.main.events
WHERE namespace = 'default' AND involved_kind = 'Pod' AND involved_name = 'web-0'
ORDER BY last_seen;
Link
horizontalpodautoscalers 1 example20 cols

HorizontalPodAutoscalers with target, replica bounds, current/desired replicas and metrics

Columns
namespace VARCHAR
Namespace of the HorizontalPodAutoscaler.
name VARCHAR
Name of the HorizontalPodAutoscaler (metadata.name).
uidnot null VARCHAR
Unique id of the HorizontalPodAutoscaler (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the HorizontalPodAutoscaler was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
target_api_version VARCHAR
apiVersion of the scaled object.
target_kind VARCHAR
Kind of the scaled object, e.g. Deployment.
target_name VARCHAR
Name of the scaled object.
min_replicas BIGINT
Minimum count of pods.
max_replicas BIGINT
Maximum count of pods.
current_replicas BIGINT
Count of pods the target runs now.
desired_replicas BIGINT
Count of pods the autoscaler wants.
last_scale_time TIMESTAMP WITH TIME ZONE
When it last scaled.
metrics JSON
spec.metrics: what it scales on (resource, pods, object, external), as JSON.
current_metrics JSON
status.currentMetrics as JSON.
conditions STRUCT of 5 fields[]
Status conditions: type, status (True/False/Unknown), reason, message, last_transition_time. Types: AbleToScale, ScalingActive, ScalingLimited.
STRUCT[] 5 fields
  • typeVARCHAR
  • statusVARCHAR
  • reasonVARCHAR
  • messageVARCHAR
  • last_transition_timeTIMESTAMP WITH TIME ZONE
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Autoscalers pinned at their maximum

SELECT namespace, name, target_kind, target_name, max_replicas
FROM kubernetes.main.horizontalpodautoscalers
WHERE current_replicas >= max_replicas
ORDER BY namespace, name;
Link
ingresses 2 examples16 cols

Ingresses with class, host/path rules and their backend services, TLS hosts and addresses

Columns
namespace VARCHAR
Namespace of the Ingress.
name VARCHAR
Name of the Ingress (metadata.name).
uidnot null VARCHAR
Unique id of the Ingress (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Ingress was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
ingress_class_name VARCHAR
IngressClass.
hosts VARCHAR[]
Distinct hosts of the rules.
rules STRUCT of 5 fields[]
One entry per host/path: host, path, path_type, service_name, service_port.
STRUCT[] 5 fields
  • hostVARCHAR
  • pathVARCHAR
  • path_typeVARCHAR
  • service_nameVARCHAR
  • service_portVARCHAR
tls STRUCT(hosts VARCHAR[], secret_name VARCHAR)[]
TLS blocks: hosts and secret_name.
default_backend_service VARCHAR
Service of spec.defaultBackend.
default_backend_port VARCHAR
Port (number or name) of spec.defaultBackend.
load_balancer_ingress VARCHAR[]
Load-balancer IPs or hostnames.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (2)

Every routed host and path with its backend service

SELECT namespace, name, r.host, r.path, r.service_name, r.service_port
FROM kubernetes.main.ingresses,
     UNNEST(rules) AS u(r)
ORDER BY r.host, r.path;

Hosts served without TLS

SELECT namespace, name, unnest(hosts) AS host
FROM kubernetes.main.ingresses
WHERE len(tls) = 0
ORDER BY host;
Link
jobs 2 examples26 cols

Jobs with status, completions, active/succeeded/failed pods, timing and owning CronJob

Columns
namespace VARCHAR
Namespace of the Job.
name VARCHAR
Name of the Job (metadata.name).
uidnot null VARCHAR
Unique id of the Job (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Job was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
status VARCHAR
Complete, Failed, Suspended or Running (from the conditions).
completions BIGINT
Desired count of successful pods.
parallelism BIGINT
Maximum count of pods running at once.
active BIGINT
Count of pods running now.
ready_pods BIGINT
Count of active pods that are ready.
succeeded BIGINT
Count of pods that succeeded.
failed BIGINT
Count of pods that failed.
backoff_limit BIGINT
Count of pod retries before the job is marked failed.
completion_mode VARCHAR
NonIndexed or Indexed.
suspend BOOLEAN
Whether the job is suspended.
start_time TIMESTAMP WITH TIME ZONE
When the job started.
completion_time TIMESTAMP WITH TIME ZONE
When the job completed (successful jobs only).
duration_seconds DOUBLE
completion_time - start_time, in seconds.
cron_job VARCHAR
Name of the owning CronJob.
images VARCHAR[]
Distinct container images of the pod template.
containers STRUCT of 9 fields[]
Containers of the pod template: name, kind (init, sidecar or app), image, cpu_request_millicores, cpu_limit_millicores, memory_request_bytes, memory_limit_bytes, ports (container ports), command.
STRUCT[] 9 fields
  • nameVARCHAR
  • kindVARCHAR
  • imageVARCHAR
  • cpu_request_millicoresBIGINT
  • cpu_limit_millicoresBIGINT
  • memory_request_bytesBIGINT
  • memory_limit_bytesBIGINT
  • portsBIGINT[]
  • commandVARCHAR[]
conditions STRUCT of 5 fields[]
Status conditions: type, status (True/False/Unknown), reason, message, last_transition_time. Types: Complete, Failed, Suspended, FailureTarget, SuccessCriteriaMet.
STRUCT[] 5 fields
  • typeVARCHAR
  • statusVARCHAR
  • reasonVARCHAR
  • messageVARCHAR
  • last_transition_timeTIMESTAMP WITH TIME ZONE
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (2)

Failed jobs in the last day

SELECT namespace, name, failed, start_time
FROM kubernetes.main.jobs
WHERE status = 'Failed' AND start_time > now() - INTERVAL 1 DAY
ORDER BY start_time DESC;

Average duration of completed jobs per CronJob

SELECT namespace, cron_job, avg(duration_seconds) AS avg_seconds
FROM kubernetes.main.jobs
WHERE status = 'Complete' AND cron_job IS NOT NULL
GROUP BY ALL
ORDER BY avg_seconds DESC;
Link
namespaces 1 example9 cols

Namespaces of the cluster, one row each

Columns
name VARCHAR
Name of the Namespace (metadata.name).
uidnot null VARCHAR
Unique id of the Namespace (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Namespace was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
phase VARCHAR
Active or Terminating.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Namespaces with their pod security enforcement level

SELECT name, phase, labels['pod-security.kubernetes.io/enforce'] AS enforce
FROM kubernetes.main.namespaces
ORDER BY name;
Link
networkpolicies 1 example19 cols

NetworkPolicies with the pods they select, policy types, rule counts and default-deny flags

Columns
namespace VARCHAR
Namespace of the NetworkPolicy.
name VARCHAR
Name of the NetworkPolicy (metadata.name).
uidnot null VARCHAR
Unique id of the NetworkPolicy (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the NetworkPolicy was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
pod_selector VARCHAR
Selected pods, kubectl selector syntax ('' selects every pod in the namespace).
pod_selector_labels MAP(VARCHAR, VARCHAR)
matchLabels of the pod selector.
selects_all_pods BOOLEAN
Whether the pod selector is empty (applies to every pod).
policy_types VARCHAR[]
Ingress and/or Egress.
ingress_rule_count BIGINT
Count of ingress rules.
egress_rule_count BIGINT
Count of egress rules.
default_deny_ingress BOOLEAN
Policy type Ingress with no ingress rules: denies all inbound traffic to the selected pods.
default_deny_egress BOOLEAN
Policy type Egress with no egress rules: denies all outbound traffic.
ingress JSON
spec.ingress rules (from peers and ports) as JSON.
egress JSON
spec.egress rules (to peers and ports) as JSON.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Namespaces with a default-deny ingress policy

SELECT DISTINCT namespace
FROM kubernetes.main.networkpolicies
WHERE default_deny_ingress
ORDER BY namespace;
Link
node_metrics 1 example8 cols

Current CPU and memory usage per node from metrics.k8s.io (kubectl top nodes)

Columns
node_namenot null VARCHAR
Node the sample is for (joins nodes.name).
timestamp TIMESTAMP WITH TIME ZONE
When the sample was taken.
window_seconds DOUBLE
Sampling window in seconds.
cpu_usage_millicores DOUBLE
CPU in use, in millicores.
memory_usage_bytes BIGINT
Working-set memory in bytes.
labels MAP(VARCHAR, VARCHAR)
Labels of the node.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (node_name)
Example

Node CPU and memory utilisation against allocatable

SELECT n.name,
  m.cpu_usage_millicores / n.allocatable_cpu_millicores AS cpu_util,
  m.memory_usage_bytes / n.allocatable_memory_bytes AS mem_util
FROM kubernetes.main.node_metrics m
JOIN kubernetes.main.nodes n ON n.name = m.node_name
ORDER BY cpu_util DESC;
Link
nodes 2 examples34 cols

Cluster nodes with capacity, allocatable resources, conditions, taints and versions

Columns
name VARCHAR
Name of the Node (metadata.name).
uidnot null VARCHAR
Unique id of the Node (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Node was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
ready BOOLEAN
Whether the Ready condition is True.
unschedulable BOOLEAN
Whether the node is cordoned (spec.unschedulable).
roles VARCHAR[]
Roles from node-role.kubernetes.io/<role> labels, e.g. control-plane.
internal_ip VARCHAR
First InternalIP address.
external_ip VARCHAR
First ExternalIP address.
addresses STRUCT("type" VARCHAR, address VARCHAR)[]
All addresses: type (InternalIP, ExternalIP, Hostname, ...) and address.
pod_cidr VARCHAR
Pod CIDR assigned to the node.
provider_id VARCHAR
Cloud provider id of the machine.
kubelet_version VARCHAR
Kubelet version, e.g. v1.31.2.
container_runtime_version VARCHAR
Container runtime, e.g. containerd://1.7.18.
os_image VARCHAR
Operating system image.
kernel_version VARCHAR
Linux (or Windows) kernel release of the node, from uname -r.
architecture VARCHAR
CPU architecture, e.g. amd64, arm64.
operating_system VARCHAR
linux or windows.
capacity_cpu_millicores BIGINT
Total CPU in millicores.
capacity_memory_bytes BIGINT
Total memory in bytes.
capacity_pods BIGINT
Maximum count of pods the node can run.
capacity_ephemeral_storage_bytes BIGINT
Total ephemeral storage in bytes.
allocatable_cpu_millicores BIGINT
CPU available to pods, in millicores.
allocatable_memory_bytes BIGINT
Memory available to pods, in bytes.
allocatable_pods BIGINT
Count of pods that can be scheduled on the node.
allocatable_ephemeral_storage_bytes BIGINT
Ephemeral storage available to pods, in bytes.
capacity MAP(VARCHAR, VARCHAR)
Every capacity quantity (cpu, memory, pods, hugepages-*, extended resources) as text.
allocatable MAP(VARCHAR, VARCHAR)
Every allocatable quantity as text.
conditions STRUCT of 5 fields[]
Status conditions: type, status (True/False/Unknown), reason, message, last_transition_time. Types: Ready, MemoryPressure, DiskPressure, PIDPressure, NetworkUnavailable.
STRUCT[] 5 fields
  • typeVARCHAR
  • statusVARCHAR
  • reasonVARCHAR
  • messageVARCHAR
  • last_transition_timeTIMESTAMP WITH TIME ZONE
taints STRUCT of 4 fields[]
Taints: key, value, effect (NoSchedule, PreferNoSchedule, NoExecute), time_added.
STRUCT[] 4 fields
  • keyVARCHAR
  • valueVARCHAR
  • effectVARCHAR
  • time_addedTIMESTAMP WITH TIME ZONE
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (2)

Allocatable CPU cores and memory GiB per ready node

SELECT name, allocatable_cpu_millicores / 1000.0 AS cpu_cores,
  allocatable_memory_bytes / 2^30 AS memory_gib
FROM kubernetes.main.nodes
WHERE ready
ORDER BY name;

Nodes with a NoSchedule taint

SELECT name, t.key, t.effect
FROM kubernetes.main.nodes,
     UNNEST(taints) AS u(t)
WHERE t.effect = 'NoSchedule'
ORDER BY name;
Link
persistentvolumeclaims 1 example16 cols

PersistentVolumeClaims with phase, requested and bound capacity, storage class and volume

Columns
namespace VARCHAR
Namespace of the PersistentVolumeClaim.
name VARCHAR
Name of the PersistentVolumeClaim (metadata.name).
uidnot null VARCHAR
Unique id of the PersistentVolumeClaim (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the PersistentVolumeClaim was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
phase VARCHAR
Pending, Bound or Lost.
storage_class VARCHAR
Requested StorageClass.
volume_name VARCHAR
Bound PersistentVolume.
volume_mode VARCHAR
Filesystem or Block.
access_modes VARCHAR[]
Requested access modes.
requested_bytes BIGINT
Requested storage in bytes.
capacity_bytes BIGINT
Actual bound capacity in bytes.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Requested storage per storage class, in GiB

SELECT storage_class, sum(requested_bytes) / 2^30 AS gib
FROM kubernetes.main.persistentvolumeclaims
GROUP BY storage_class
ORDER BY gib DESC;
Link
persistentvolumes 1 example20 cols

PersistentVolumes with capacity, phase, claim, storage class and volume source

Columns
name VARCHAR
Name of the PersistentVolume (metadata.name).
uidnot null VARCHAR
Unique id of the PersistentVolume (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the PersistentVolume was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
phase VARCHAR
Available, Bound, Released, Failed or Pending.
capacity_bytes BIGINT
Storage capacity in bytes.
access_modes VARCHAR[]
ReadWriteOnce, ReadOnlyMany, ReadWriteMany, ReadWriteOncePod.
reclaim_policy VARCHAR
Retain, Delete or Recycle.
storage_class VARCHAR
StorageClass name.
volume_mode VARCHAR
Filesystem or Block.
claim_namespace VARCHAR
Namespace of the bound claim.
claim_name VARCHAR
Name of the bound claim.
source_type VARCHAR
Volume plugin: csi, hostPath, local, nfs, ...
csi_driver VARCHAR
CSI driver name.
csi_volume_handle VARCHAR
The CSI driver's id of the backing volume, e.g. a cloud disk id.
reason VARCHAR
Status reason.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Released or failed volumes still holding storage

SELECT name, phase, capacity_bytes / 2^30 AS gib, claim_namespace,
  claim_name
FROM kubernetes.main.persistentvolumes
WHERE phase IN ('Released', 'Failed')
ORDER BY gib DESC;
Link
pod_containers 2 examples25 cols

One row per container of every pod (init, sidecar, app and ephemeral), with its status and resources

Columns
namespace VARCHAR
Namespace of the pod.
pod_name VARCHAR
Name of the pod.
pod_uidnot null VARCHAR
UID of the pod.
node_name VARCHAR
Node the pod runs on.
phase VARCHAR
Phase of the pod.
container_namenot null VARCHAR
Name of the container.
kind VARCHAR
init, sidecar, app or ephemeral.
image VARCHAR
Image reference.
image_id VARCHAR
Resolved image digest.
ready BOOLEAN
Whether the container passes its readiness probe.
started BOOLEAN
Whether the startup probe passed.
restart_count BIGINT
Count of restarts of this container.
state VARCHAR
running, waiting or terminated.
state_reason VARCHAR
Why it is waiting/terminated, e.g. CrashLoopBackOff, ImagePullBackOff, Completed, Error.
state_message VARCHAR
Detail for state_reason.
exit_code BIGINT
Process exit status (0 = success) when terminated.
started_at TIMESTAMP WITH TIME ZONE
When the current state started (running or terminated).
last_termination_reason VARCHAR
Reason the previous instance terminated, e.g. OOMKilled, Error.
last_termination_exit_code BIGINT
Process exit status (0 = success) of the previous instance.
cpu_request_millicores BIGINT
CPU request in millicores.
cpu_limit_millicores BIGINT
CPU limit in millicores.
memory_request_bytes BIGINT
Memory request in bytes.
memory_limit_bytes BIGINT
Memory limit in bytes.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (pod_uid, container_name)
Examples (2)

Containers that were OOM-killed last time they stopped

SELECT namespace, pod_name, container_name, restart_count
FROM kubernetes.main.pod_containers
WHERE last_termination_reason = 'OOMKilled'
ORDER BY restart_count DESC;

Running containers without a memory limit

SELECT namespace, pod_name, container_name, image
FROM kubernetes.main.pod_containers
WHERE state = 'running' AND memory_limit_bytes IS NULL
ORDER BY namespace, pod_name;
Link
pod_metrics 2 examples10 cols

Current CPU and memory usage per container from metrics.k8s.io (kubectl top pods --containers)

Columns
namespacenot null VARCHAR
Namespace of the pod.
pod_namenot null VARCHAR
Pod the sample is for (joins pods.name).
container_namenot null VARCHAR
Container within the pod (joins pod_containers.container_name).
timestamp TIMESTAMP WITH TIME ZONE
When the sample was taken.
window_seconds DOUBLE
Sampling window in seconds.
cpu_usage_millicores DOUBLE
CPU in use, in millicores.
memory_usage_bytes BIGINT
Working-set memory in bytes.
labels MAP(VARCHAR, VARCHAR)
Labels of the pod.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (namespace, pod_name, container_name)
Examples (2)

Containers using more memory than they request

SELECT m.namespace, m.pod_name, m.container_name, m.memory_usage_bytes,
  c.memory_request_bytes
FROM kubernetes.main.pod_metrics m
JOIN kubernetes.main.pod_containers c USING (namespace, pod_name, container_name)
WHERE m.memory_usage_bytes > c.memory_request_bytes
ORDER BY m.memory_usage_bytes DESC;

Top CPU consumers per namespace

SELECT namespace, sum(cpu_usage_millicores) AS millicores
FROM kubernetes.main.pod_metrics
GROUP BY namespace
ORDER BY millicores DESC;
Link
pods 3 examples37 cols

Pods with phase, node, readiness, restarts, resource requests/limits and containers

Columns
namespace VARCHAR
Namespace of the Pod.
name VARCHAR
Name of the Pod (metadata.name).
uidnot null VARCHAR
Unique id of the Pod (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Pod was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
phase VARCHAR
Pending, Running, Succeeded, Failed or Unknown.
ready BOOLEAN
Whether the Ready condition is True.
node_name VARCHAR
Node the pod is scheduled on (NULL while unscheduled).
pod_ip VARCHAR
Pod IP address.
host_ip VARCHAR
IP of the node hosting the pod.
service_account VARCHAR
ServiceAccount the pod runs as.
qos_class VARCHAR
Guaranteed, Burstable or BestEffort.
priority_class_name VARCHAR
PriorityClass the pod requests (see priorityclasses).
priority BIGINT
Resolved scheduling priority score (integer from the PriorityClass).
restart_policy VARCHAR
Always, OnFailure or Never.
host_network BOOLEAN
Whether the pod uses the host network namespace.
start_time TIMESTAMP WITH TIME ZONE
When the kubelet acknowledged the pod.
deletion_timestamp TIMESTAMP WITH TIME ZONE
When deletion was requested (NULL unless terminating).
reason VARCHAR
Pod-level status reason, e.g. Evicted.
message VARCHAR
Pod-level status message.
controller_kind VARCHAR
Kind of the controlling owner (ReplicaSet, StatefulSet, DaemonSet, Job, ...).
controller_name VARCHAR
Name of the controlling owner.
restart_count BIGINT
Count of container restarts, summed over all containers.
container_count BIGINT
Count of app containers.
ready_container_count BIGINT
Count of ready app containers.
cpu_request_millicores BIGINT
CPU requests summed over app containers, in millicores.
cpu_limit_millicores BIGINT
CPU limits summed over app containers, in millicores.
memory_request_bytes BIGINT
Memory requests summed over app containers, in bytes.
memory_limit_bytes BIGINT
Memory limits summed over app containers, in bytes.
images VARCHAR[]
Distinct container images, init containers first.
containers STRUCT of 18 fields[]
Containers with their status: name, kind (init, sidecar, app or ephemeral), image, image_id, ready, started, restart_count, state (running, waiting, terminated), state_reason (e.g. CrashLoopBackOff, ImagePullBackOff, Completed, OOMKilled), state_message, exit_code, started_at, last_termination_reason, last_termination_exit_code, cpu_request_millicores, cpu_limit_millicores, memory_request_bytes, memory_limit_bytes.
STRUCT[] 18 fields
  • nameVARCHAR
  • kindVARCHAR
  • imageVARCHAR
  • image_idVARCHAR
  • readyBOOLEAN
  • startedBOOLEAN
  • restart_countBIGINT
  • stateVARCHAR
  • state_reasonVARCHAR
  • state_messageVARCHAR
  • exit_codeBIGINT
  • started_atTIMESTAMP WITH TIME ZONE
  • last_termination_reasonVARCHAR
  • last_termination_exit_codeBIGINT
  • cpu_request_millicoresBIGINT
  • cpu_limit_millicoresBIGINT
  • memory_request_bytesBIGINT
  • memory_limit_bytesBIGINT
conditions STRUCT of 5 fields[]
Status conditions: type, status (True/False/Unknown), reason, message, last_transition_time. Types: PodScheduled, Initialized, ContainersReady, Ready.
STRUCT[] 5 fields
  • typeVARCHAR
  • statusVARCHAR
  • reasonVARCHAR
  • messageVARCHAR
  • last_transition_timeTIMESTAMP WITH TIME ZONE
node_selector MAP(VARCHAR, VARCHAR)
spec.nodeSelector.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (3)

Pods not running or succeeded, with their reason

SELECT namespace, name, phase, reason
FROM kubernetes.main.pods
WHERE phase NOT IN ('Running', 'Succeeded')
ORDER BY namespace, name;

Containers waiting in CrashLoopBackOff

SELECT namespace, name, c.name AS container, c.restart_count
FROM kubernetes.main.pods,
     UNNEST(containers) AS u(c)
WHERE c.state_reason = 'CrashLoopBackOff'
ORDER BY namespace, name;

CPU requested per node, in cores

SELECT node_name, sum(cpu_request_millicores) / 1000.0 AS cpu_cores
FROM kubernetes.main.pods
WHERE phase = 'Running'
GROUP BY node_name
ORDER BY cpu_cores DESC;
Link
priorityclasses 1 example12 cols

PriorityClasses with their value, global default flag and preemption policy

Columns
name VARCHAR
Name of the PriorityClass (metadata.name).
uidnot null VARCHAR
Unique id of the PriorityClass (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the PriorityClass was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
value BIGINT
Priority number (unitless integer score); higher schedules first and may preempt lower.
global_default BOOLEAN
Whether pods without a class get this one.
preemption_policy VARCHAR
PreemptLowerPriority or Never.
description VARCHAR
Free-text purpose of the class, set by its author.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Priority classes from highest to lowest

SELECT name, value, preemption_policy
FROM kubernetes.main.priorityclasses
ORDER BY value DESC;
Link
rbac_rules 2 examples12 cols

Every Role and ClusterRole rule flattened to one row per api_group, resource and verb (or non-resource URL and verb)

Columns
idnot null VARCHAR
Row identity: role_kind/namespace/role_name#rule_index/api_group/resource/verb (or the URL).
role_kind VARCHAR
Role or ClusterRole.
namespace VARCHAR
Namespace of a Role; NULL for a ClusterRole.
role_name VARCHAR
Name of the role.
rule_index BIGINT
0-based position (index) of the rule in the role.
api_group VARCHAR
API group ('' = core, '*' = all); NULL for non-resource rules.
resource VARCHAR
Resource, possibly with subresource (pods/exec) or '*'; NULL for non-resource rules.
resource_names VARCHAR[]
Restricts the rule to these object names; empty = all.
verb VARCHAR
One verb: get, list, watch, create, update, patch, delete, deletecollection, escalate, bind, impersonate or '*'.
non_resource_url VARCHAR
Non-resource URL such as /healthz or /metrics*; NULL for resource rules.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (id)
Examples (2)

Roles and cluster roles that can read secrets

SELECT role_kind, namespace, role_name
FROM kubernetes.main.rbac_rules
WHERE resource IN ('secrets', '*') AND verb IN ('get', 'list', 'watch', '*') AND api_group IN ('', '*')
GROUP BY ALL
ORDER BY ALL;

Who can exec into pods, via which binding

SELECT b.subject_kind, b.subject_name, r.role_name
FROM kubernetes.main.rbac_rules r
JOIN kubernetes.main.rbac_subjects b ON b.role_name = r.role_name AND b.role_kind = r.role_kind
WHERE r.resource = 'pods/exec' AND r.verb IN ('create', '*')
ORDER BY ALL;
Link
rbac_subjects 1 example11 cols

Every RoleBinding and ClusterRoleBinding flattened to one row per subject, with the role it grants

Columns
idnot null VARCHAR
Row identity: binding_kind/namespace/binding_name#subject_index.
binding_kind VARCHAR
RoleBinding or ClusterRoleBinding.
namespace VARCHAR
Namespace of a RoleBinding (where the grant applies); NULL for a ClusterRoleBinding.
binding_name VARCHAR
Name of the binding.
role_kind VARCHAR
Role or ClusterRole.
role_name VARCHAR
Granted role.
subject_kind VARCHAR
User, Group or ServiceAccount.
subject_name VARCHAR
User name, group name or ServiceAccount name.
subject_namespace VARCHAR
Namespace of a ServiceAccount subject.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (id)
Example

Roles granted to one service account

SELECT binding_kind, namespace, binding_name, role_kind, role_name
FROM kubernetes.main.rbac_subjects
WHERE subject_kind = 'ServiceAccount' AND subject_namespace = 'kube-system' AND subject_name = 'default'
ORDER BY ALL;
Link
replicasets 1 example17 cols

ReplicaSets with replica counts, owning deployment, revision and images

Columns
namespace VARCHAR
Namespace of the ReplicaSet.
name VARCHAR
Name of the ReplicaSet (metadata.name).
uidnot null VARCHAR
Unique id of the ReplicaSet (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the ReplicaSet was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
replicas BIGINT
Desired count of pods.
current_replicas BIGINT
Observed count of pods (status.replicas).
ready_replicas BIGINT
Count of ready pods.
available_replicas BIGINT
Count of available pods.
revision VARCHAR
Deployment revision of this ReplicaSet.
selector VARCHAR
Pod label selector in kubectl syntax.
images VARCHAR[]
Distinct container images of the pod template.
containers STRUCT of 9 fields[]
Containers of the pod template: name, kind (init, sidecar or app), image, cpu_request_millicores, cpu_limit_millicores, memory_request_bytes, memory_limit_bytes, ports (container ports), command.
STRUCT[] 9 fields
  • nameVARCHAR
  • kindVARCHAR
  • imageVARCHAR
  • cpu_request_millicoresBIGINT
  • cpu_limit_millicoresBIGINT
  • memory_request_bytesBIGINT
  • memory_limit_bytesBIGINT
  • portsBIGINT[]
  • commandVARCHAR[]
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Old, scaled-down ReplicaSets kept per deployment

SELECT namespace, owner_references[1].name AS deployment,
  count(*) AS old_replicasets
FROM kubernetes.main.replicasets
WHERE replicas = 0
GROUP BY ALL
ORDER BY old_replicasets DESC;
Link
rolebindings 1 example12 cols

Namespaced RoleBindings: which Role or ClusterRole is granted to which subjects

Columns
namespace VARCHAR
Namespace of the RoleBinding.
name VARCHAR
Name of the RoleBinding (metadata.name).
uidnot null VARCHAR
Unique id of the RoleBinding (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the RoleBinding was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
role_kind VARCHAR
Role or ClusterRole.
role_name VARCHAR
Name of the granted role.
subjects STRUCT of 4 fields[]
Subjects: kind (User, Group, ServiceAccount), name, namespace, api_group.
STRUCT[] 4 fields
  • kindVARCHAR
  • nameVARCHAR
  • namespaceVARCHAR
  • api_groupVARCHAR
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Bindings that grant cluster-admin inside a namespace

SELECT namespace, name, subjects
FROM kubernetes.main.rolebindings
WHERE role_name = 'cluster-admin'
ORDER BY namespace, name;
Link
roles 1 example10 cols

Namespaced RBAC Roles with their rules

Columns
namespace VARCHAR
Namespace of the Role.
name VARCHAR
Name of the Role (metadata.name).
uidnot null VARCHAR
Unique id of the Role (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Role was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
rules STRUCT of 5 fields[]
Rules: api_groups ('' = core), resources (with subresources such as pods/exec), resource_names, verbs, non_resource_urls.
STRUCT[] 5 fields
  • api_groupsVARCHAR[]
  • resourcesVARCHAR[]
  • resource_namesVARCHAR[]
  • verbsVARCHAR[]
  • non_resource_urlsVARCHAR[]
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Roles with the most rules

SELECT namespace, name, len(rules) AS rule_count
FROM kubernetes.main.roles
ORDER BY rule_count DESC, namespace, name;
Link
secrets 2 examples12 cols

Secrets by name, type and keys; values are never returned

Columns
namespace VARCHAR
Namespace of the Secret.
name VARCHAR
Name of the Secret (metadata.name).
uidnot null VARCHAR
Unique id of the Secret (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Secret was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
type VARCHAR
Secret type, e.g. Opaque, kubernetes.io/tls, kubernetes.io/dockerconfigjson.
keys VARCHAR[]
Keys present in data, sorted. Values are never returned.
immutable BOOLEAN
Whether the Secret is immutable.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (2)

Secrets by type

SELECT type, count(*) AS secrets
FROM kubernetes.main.secrets
GROUP BY type
ORDER BY secrets DESC;

TLS secrets in one namespace

SELECT name, keys
FROM kubernetes.main.secrets
WHERE namespace = 'default' AND type = 'kubernetes.io/tls'
ORDER BY name;
Link
serviceaccounts 1 example12 cols

ServiceAccounts with their secrets, image pull secrets and token automount setting

Columns
namespace VARCHAR
Namespace of the ServiceAccount.
name VARCHAR
Name of the ServiceAccount (metadata.name).
uidnot null VARCHAR
Unique id of the ServiceAccount (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the ServiceAccount was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
secrets VARCHAR[]
Names of secrets listed on the ServiceAccount.
image_pull_secrets VARCHAR[]
Names of image pull secrets.
automount_service_account_token BOOLEAN
automountServiceAccountToken (NULL = default true).
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

Service accounts that do not opt out of token automount

SELECT namespace, name
FROM kubernetes.main.serviceaccounts
WHERE automount_service_account_token IS DISTINCT FROM false
ORDER BY namespace, name;
Link
services 2 examples21 cols

Services with type, cluster IPs, ports, selector and load-balancer addresses

Columns
namespace VARCHAR
Namespace of the Service.
name VARCHAR
Name of the Service (metadata.name).
uidnot null VARCHAR
Unique id of the Service (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the Service was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
type VARCHAR
ClusterIP, NodePort, LoadBalancer or ExternalName.
cluster_ip VARCHAR
Primary cluster IP (None for headless).
cluster_ips VARCHAR[]
All cluster IPs (dual stack).
external_ips VARCHAR[]
spec.externalIPs.
external_name VARCHAR
DNS name for ExternalName services.
load_balancer_ingress VARCHAR[]
Load-balancer IPs or hostnames.
ports STRUCT of 6 fields[]
Ports: name, protocol, port, target_port (number or name), node_port, app_protocol.
STRUCT[] 6 fields
  • nameVARCHAR
  • protocolVARCHAR
  • portBIGINT
  • target_portVARCHAR
  • node_portBIGINT
  • app_protocolVARCHAR
selector_labels MAP(VARCHAR, VARCHAR)
Pod selector (spec.selector); empty for services without one.
session_affinity VARCHAR
None or ClientIP.
external_traffic_policy VARCHAR
Cluster or Local.
internal_traffic_policy VARCHAR
Cluster or Local.
ip_families VARCHAR[]
IPv4 and/or IPv6.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Examples (2)

LoadBalancer services and their external addresses

SELECT namespace, name, load_balancer_ingress
FROM kubernetes.main.services
WHERE type = 'LoadBalancer'
ORDER BY namespace, name;

Every exposed port

SELECT namespace, name, p.port, p.protocol, p.target_port
FROM kubernetes.main.services,
     UNNEST(ports) AS u(p)
ORDER BY namespace, name, p.port;
Link
statefulsets 1 example23 cols

StatefulSets with replica counts, revisions, governing service and volume claim templates

Columns
namespace VARCHAR
Namespace of the StatefulSet.
name VARCHAR
Name of the StatefulSet (metadata.name).
uidnot null VARCHAR
Unique id of the StatefulSet (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the StatefulSet was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
replicas BIGINT
Desired count of pods.
ready_replicas BIGINT
Count of ready pods.
current_replicas BIGINT
Count of pods at current_revision.
updated_replicas BIGINT
Count of pods at update_revision.
available_replicas BIGINT
Count of available pods.
service_name VARCHAR
Governing headless service.
pod_management_policy VARCHAR
OrderedReady or Parallel.
update_strategy VARCHAR
RollingUpdate or OnDelete.
current_revision VARCHAR
Revision of the current pods.
update_revision VARCHAR
Revision being rolled out.
volume_claim_templates VARCHAR[]
Names of the volume claim templates.
selector VARCHAR
Pod label selector in kubectl syntax.
images VARCHAR[]
Distinct container images of the pod template.
containers STRUCT of 9 fields[]
Containers of the pod template: name, kind (init, sidecar or app), image, cpu_request_millicores, cpu_limit_millicores, memory_request_bytes, memory_limit_bytes, ports (container ports), command.
STRUCT[] 9 fields
  • nameVARCHAR
  • kindVARCHAR
  • imageVARCHAR
  • cpu_request_millicoresBIGINT
  • cpu_limit_millicoresBIGINT
  • memory_request_bytesBIGINT
  • memory_limit_bytesBIGINT
  • portsBIGINT[]
  • commandVARCHAR[]
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

StatefulSets mid-rollout

SELECT namespace, name, current_revision, update_revision
FROM kubernetes.main.statefulsets
WHERE current_revision <> update_revision
ORDER BY namespace, name;
Link
storageclasses 1 example15 cols

StorageClasses with provisioner, reclaim policy, binding mode, expansion and default flag

Columns
name VARCHAR
Name of the StorageClass (metadata.name).
uidnot null VARCHAR
Unique id of the StorageClass (metadata.uid).
creation_timestamp TIMESTAMP WITH TIME ZONE
When the StorageClass was created.
labels MAP(VARCHAR, VARCHAR)
Labels (metadata.labels). To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
Annotations (metadata.annotations); kubectl's last-applied-configuration is redacted on Secrets and ConfigMaps.
owner_references STRUCT of 5 fields[]
Owners of this object (metadata.ownerReferences): api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
provisioner VARCHAR
Volume provisioner, e.g. ebs.csi.aws.com, rancher.io/local-path.
is_default BOOLEAN
Whether it is the default class (storageclass.kubernetes.io/is-default-class).
reclaim_policy VARCHAR
Delete or Retain.
volume_binding_mode VARCHAR
Immediate or WaitForFirstConsumer.
allow_volume_expansion BOOLEAN
Whether claims can grow.
parameters MAP(VARCHAR, VARCHAR)
Provisioner parameters.
mount_options VARCHAR[]
Options passed to mount for volumes of this class, e.g. debug, nfsvers=4.1.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
ConstraintsPRIMARY KEY (uid)
Example

The default storage class

SELECT name, provisioner, volume_binding_mode
FROM kubernetes.main.storageclasses
WHERE is_default
ORDER BY name;
Link
Scalar functions
quantity_value (quantity VARCHAR) 2 examples

Parse a Kubernetes resource quantity ('250m', '64Mi', '1.5Gi') into a number

Arguments
quantity VARCHAR
A Kubernetes quantity such as '250m' (CPU), '64Mi' or '1.5Gi' (bytes), '2k' or '1e3'.
ReturnsDOUBLE
Examples (2)

Hugepages capacity per node, in bytes

SELECT name,
  kubernetes.main.quantity_value(capacity['hugepages-2Mi']) AS hugepages_bytes
FROM kubernetes.main.nodes
ORDER BY name;
SELECT q, kubernetes.main.quantity_value(q) AS value
FROM (VALUES ('250m'), ('64Mi'), ('1G'), ('1.5Gi'), ('2'), ('bogus')) t(q)
ORDER BY q;
Link
Table functions
pod_logs (namespace VARCHAR, pod VARCHAR, container := VARCHAR, previous := BOOLEAN, since_seconds := BIGINT, since_time := TIMESTAMP WITH TIME ZONE, tail_lines := BIGINT, limit_bytes := BIGINT) 2 examples

Log lines of a pod's containers, with the runtime's timestamps (kubectl logs --timestamps)

Positional arguments
namespace VARCHAR
Namespace of the pod.
pod VARCHAR
Pod name.
Named arguments
container := VARCHAR
Container name; default every app container of the pod (init containers must be named).
previous := BOOLEAN
true to read the previous (crashed or restarted) instance of the container, like kubectl logs --previous. · default false
since_seconds := BIGINT
Only lines from the last N seconds.
since_time := TIMESTAMP WITH TIME ZONE
Only lines at or after this time.
tail_lines := BIGINT
Only the last N lines of each container.
limit_bytes := BIGINT
Maximum bytes read per container (default 10 MiB); the log is cut at this size. · default 10485760
Returns columns
namespace VARCHAR
Namespace of the pod.
pod VARCHAR
Pod name.
container VARCHAR
Container name.
line_number BIGINT
1-based line number within this container's returned log.
timestamp TIMESTAMP WITH TIME ZONE
Time the container runtime recorded the line.
message VARCHAR
The log line, without the timestamp prefix.
Examples (2)

Last 50 lines of a pod's logs

SELECT timestamp, container, message
FROM kubernetes.main.pod_logs('default', 'web-0', tail_lines := 50)
ORDER BY timestamp;

Error lines from the crashed instance of a container

SELECT timestamp, message
FROM kubernetes.main.pod_logs('default', 'worker-1', container := 'app', previous := true)
WHERE message ILIKE '%error%'
ORDER BY line_number;
Link
resources (api_version VARCHAR, resource VARCHAR) 2 examples

Lists any listable API resource, custom resources included, with metadata columns and spec/status/object as JSON

Arguments
api_version VARCHAR
API version of the resource as listed in api_resources.api_version (e.g. apps/v1).
resource VARCHAR
Resource name as listed in api_resources.resource (e.g. deployments); its kind or short name also works.
Returns columns
namespace VARCHAR
Namespace (NULL for cluster-scoped resources).
name VARCHAR
metadata.name.
uid VARCHAR
metadata.uid.
creation_timestamp TIMESTAMP WITH TIME ZONE
When the object was created.
labels MAP(VARCHAR, VARCHAR)
metadata.labels. To filter server-side, use the label_selector column.
annotations MAP(VARCHAR, VARCHAR)
metadata.annotations.
owner_references STRUCT of 5 fields[]
metadata.ownerReferences: api_version, kind, name, uid, controller.
STRUCT[] 5 fields
  • api_versionVARCHAR
  • kindVARCHAR
  • nameVARCHAR
  • uidVARCHAR
  • controllerBOOLEAN
api_version VARCHAR
apiVersion of the object.
kind VARCHAR
Kind of the object.
spec JSON
The object's spec as JSON (NULL when it has none).
status JSON
The object's status as JSON (NULL when it has none).
object JSON
The whole object as JSON, without metadata.managedFields. Secret data is removed.
label_selector VARCHAR
Pushdown-only: WHERE label_selector = 'app=web,tier!=db' sends a Kubernetes label selector (=, !=, in, notin, exists, !key) to the API server; the column echoes it. NULL otherwise.
field_selector VARCHAR
Pushdown-only: WHERE field_selector = 'status.phase=Running' sends a raw Kubernetes field selector to the API server; the column echoes it. NULL otherwise.
Examples (2)

PodDisruptionBudgets and how many disruptions they allow

SELECT namespace, name, (status->>'disruptionsAllowed')::INT AS allowed
FROM kubernetes.main.resources('policy/v1', 'poddisruptionbudgets')
ORDER BY allowed, namespace, name;

cert-manager certificates that are not ready

SELECT namespace, name, status->>'$.conditions[0].reason' AS reason
FROM kubernetes.main.resources('cert-manager.io/v1', 'certificates')
WHERE status->>'$.conditions[0].status' <> 'True'
ORDER BY namespace, name;
Link

Credentials

The secret type kubernetes declares, as reported by the worker itself.

kubernetes

How to get these credentials

How to reach a Kubernetes API server: a kubeconfig (with an optional context) or a server URL with a bearer token or client certificate. Read-only access (get/list/watch) is all the worker needs.

secret.sql
CREATE SECRET kubernetes (
    TYPE kubernetes,
    kubeconfig                 '<KUBERNETES_KUBECONFIG>',  -- secret
    context                    '<context>',
    server                     '<server>',
    token                      '<KUBERNETES_TOKEN>',  -- secret
    certificate_authority_data '<certificate_authority_data>',
    client_certificate_data    '<client_certificate_data>',
    client_key_data            '<KUBERNETES_CLIENT_KEY_DATA>',  -- secret
    tls_server_name            '<tls_server_name>',
    insecure_skip_tls_verify   '<insecure_skip_tls_verify>'
);
Key Type Required Description
kubeconfig secret VARCHAR — A whole kubeconfig file's contents, as YAML or base64-encoded YAML. Exec and auth-provider plugins in it run on the worker's host, as with kubectl.
context VARCHAR — Context in KUBECONFIG to use; default its current-context.
server VARCHAR — API server URL, e.g. https://10.0.0.1:6443. Overrides the kubeconfig's server.
token secret VARCHAR — Bearer token, e.g. a ServiceAccount token from `kubectl create token`.
certificate_authority_data VARCHAR — PEM (or base64 PEM) CA bundle that signed the API server's certificate; default the system roots.
client_certificate_data VARCHAR — PEM (or base64 PEM) client certificate for mutual TLS.
client_key_data secret VARCHAR — PEM (or base64 PEM) private key of CLIENT_CERTIFICATE_DATA.
tls_server_name VARCHAR — Server name to verify in the API server's certificate, when it differs from the SERVER host.
insecure_skip_tls_verify VARCHAR — 'true' to skip verifying the server certificate (test clusters only).

The worker doesn't mark which keys are required.

Needed by pod_logsresources

Create the secret in the same session, after attaching kubernetes — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

Allocatable CPU cores and memory GiB per ready node

SELECT name, allocatable_cpu_millicores / 1000.0 AS cpu_cores,
  allocatable_memory_bytes / 2^30 AS memory_gib
FROM kubernetes.main.nodes
WHERE ready
ORDER BY name

Uses nodes

Pods not running or succeeded, with their reason

SELECT namespace, name, phase, reason
FROM kubernetes.main.pods
WHERE phase NOT IN ('Running', 'Succeeded')
ORDER BY namespace, name

Uses pods

Containers that were OOM-killed last time they stopped

SELECT namespace, pod_name, container_name, restart_count
FROM kubernetes.main.pod_containers
WHERE last_termination_reason = 'OOMKilled'
ORDER BY restart_count DESC

Uses pod_containers

Deployments with fewer ready replicas than desired

SELECT namespace, name, replicas, ready_replicas
FROM kubernetes.main.deployments
WHERE coalesce(ready_replicas, 0) < replicas
ORDER BY namespace, name

Uses deployments

Old, scaled-down ReplicaSets kept per deployment

SELECT namespace, owner_references[1].name AS deployment,
  count(*) AS old_replicasets
FROM kubernetes.main.replicasets
WHERE replicas = 0
GROUP BY ALL
ORDER BY old_replicasets DESC

Uses replicasets

StatefulSets mid-rollout

SELECT namespace, name, current_revision, update_revision
FROM kubernetes.main.statefulsets
WHERE current_revision <> update_revision
ORDER BY namespace, name

Uses statefulsets

44 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the Kubernetes worker, which pods in namespace vgi-fixture have restarted at least once?
  • How many ready replicas does the deployment web in namespace vgi-fixture have, out of how many desired?
  • What is the total memory request, in bytes, of all containers of the pods labelled app=web in namespace vgi-fixture?
  • Which keys does the Secret db-credentials in namespace vgi-fixture contain?
  • List the names of the Widget custom resources (group fixture.vgi.query.farm) and the size in each one's spec.
  • Which Roles in namespace vgi-fixture grant the get verb on secrets?

Kubernetes is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.