Table: kubernetes_event - Query Kubernetes Events using SQL
Kubernetes Events are objects that provide insight into what is happening inside a cluster, such as what decisions were made by scheduler or why some pods were evicted from the node. Events are a resource type in Kubernetes that are automatically created when certain situations occur, and they give developers a tool to understand the activity of the system.
Table Usage Guide
The kubernetes_event
table provides insights into events within a Kubernetes system. As a DevOps engineer or system administrator, explore event-specific details through this table, including the involved object, source, message, and related metadata. Utilize it to monitor system behaviors, troubleshoot issues, and understand the state changes in the workloads running on the cluster.
Examples
Basic Info
Explore the recent events in your Kubernetes environment to understand the status and health of your objects. This query can help you identify any issues or anomalies, providing valuable insights for troubleshooting and maintenance.
select namespace, last_timestamp, type, reason, concat( involved_object ->> 'kind', '/', involved_object ->> 'name' ) as object, messagefrom kubernetes_event;
select namespace, last_timestamp, type, reason, involved_object || '/' || involved_object as object, messagefrom kubernetes_event;
List warning events by last timestamp
Identify instances where warning events have occurred in your Kubernetes environment. This query is useful for tracking and understanding the chronology of these events to manage and troubleshoot issues effectively.
select namespace, last_timestamp, type, reason, concat( involved_object ->> 'kind', '/', involved_object ->> 'name' ) as object, messagefrom kubernetes_eventwhere type = 'Warning'order by namespace, last_timestamp;
select namespace, last_timestamp, type, reason, involved_object || '/' || involved_object as object, messagefrom kubernetes_eventwhere type = 'Warning'order by namespace, last_timestamp;
List manifest resources
Explore which Kubernetes events have a defined path to gain insights into the health and status of your Kubernetes resources. This can help identify any potential issues or anomalies within your system.
select namespace, type, reason, concat( involved_object ->> 'kind', '/', involved_object ->> 'name' ) as object, message, pathfrom kubernetes_eventwhere path is not null;
select namespace, type, reason, involved_object || '/' || involved_object as object, message, pathfrom kubernetes_eventwhere path is not null;
Schema for kubernetes_event
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
action | text | What action was taken/failed with the regarding object. | |
annotations | jsonb | Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. | |
context_name | text | Kubectl config context name. | |
count | bigint | The number of times this event has occurred. | |
creation_timestamp | timestamp with time zone | CreationTimestamp is a timestamp representing the server time when this object was created. | |
deletion_grace_period_seconds | bigint | Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. | |
deletion_timestamp | timestamp with time zone | DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. | |
end_line | bigint | The path to the manifest file. | |
event_time | timestamp with time zone | Time when this event was first observed. | |
finalizers | jsonb | Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. | |
first_timestamp | timestamp with time zone | The time at which the event was first recorded. | |
generate_name | text | GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. | |
generation | bigint | A sequence number representing a specific generation of the desired state. | |
involved_object | jsonb | The object that this event is about. | |
labels | jsonb | Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. | |
last_timestamp | timestamp with time zone | Time when this event was last observed. | |
message | text | A description of the status of this operation. | |
name | text | Name of the object. Name must be unique within a namespace. | |
namespace | text | Namespace defines the space within which each name must be unique. | |
owner_references | jsonb | List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. | |
path | text | The path to the manifest file. | |
reason | text | The reason the transition into the object's current status. | |
related | jsonb | Optional secondary object for more complex actions. | |
reporting_component | text | Name of the controller that emitted this event. | |
reporting_instance | text | ID of the controller instance. | |
resource_version | text | An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. | |
series | jsonb | Data about the event series this event represents. | |
source | jsonb | The component reporting this event. | |
source_type | text | The source of the resource. Possible values are: deployed and manifest. If the resource is fetched from the spec file the value will be manifest. | |
sp_connection_name | text | Steampipe connection name. | |
sp_ctx | jsonb | Steampipe context in JSON form. | |
start_line | bigint | The path to the manifest file. | |
type | text | Type of this event (Normal, Warning), new types could be added in the future. | |
uid | text | UID is the unique in time and space value for this object. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- kubernetes
You can pass the configuration to the command with the --config
argument:
steampipe_export_kubernetes --config '<your_config>' kubernetes_event