> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kubernetes Cloud Query

## Background[​](#background "Direct link to Background")

The *Run Kubernetes Cloud Query* Action performs [Steampipe queries](https://hub.steampipe.io/plugins/turbot/kubernetes) on K8s resources with a powerful and simple PostgreSQL syntax.

For example, listing all k8s jobs can be done simply:

```
select  name,  namespace,  active,  succeeded,  failed,  completions,  start_time,  completion_time,  age(coalesce(completion_time, current_timestamp), start_time) as duration,  active_deadline_seconds,  parallelism,  selector,  labels,  annotationsfrom  kubernetes_job;
```

List only the active jobs:

```
select  name,  namespace,  start_time,  age(coalesce(completion_time, current_timestamp), start_time) as duration,  active,  succeeded,  failedfrom  kubernetes_jobwhere active > 0;
```

A query to list all container statuses:

```
select  namespace,  name as pod_name,  phase,  cs ->> 'name' as container_name,  cs ->> 'image' as image,  cs ->> 'ready' as ready,  cs_state as state,  cs ->> 'started' as started,  cs ->> 'restartCount' as restartsfrom  kubernetes_pod,  jsonb_array_elements(container_statuses) as cs,  jsonb_object_keys(cs -> 'state') as cs_stateorder by  namespace,  name,  container_name;
```

A full description of all existing tables and official examples are provided here:

* [The Official Kubernetes Plugin Documentation](https://hub.steampipe.io/plugins/turbot/kubernetes/tables)
* [The Blink Automation Library](https://library.blinkops.com/workflows?vendors=Kubernetes\&level=basic)

<Info>
  Blink supports this Steampipe version: v0.15.0.
</Info>

## Action Parameters[​](#action-parameters "Direct link to Action Parameters")

| Parameter     | Description                                                                                 |
| ------------- | ------------------------------------------------------------------------------------------- |
| SQL statement | The SQL query to execute against database resources. Use standard SQL syntax.               |
| Output format | The representation of the output result. The possible options are "Table", "CSV" or "JSON". |

<img src="https://mintcdn.com/blinkops-2/deay2AiePWJDKGEh/img/Actions/Steampipe/RunKubernetesCloudQuery.png?fit=max&auto=format&n=deay2AiePWJDKGEh&q=85&s=260a7d4ca82abae745d749d38d75df1e" alt="RunAWSCloudQuery" width="887" height="394" data-path="img/Actions/Steampipe/RunKubernetesCloudQuery.png" />
