turbot/kubernetes
steampipe plugin install kubernetes

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,
message
from
kubernetes_event;
select
namespace,
last_timestamp,
type,
reason,
involved_object || '/' || involved_object as object,
message
from
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,
message
from
kubernetes_event
where
type = 'Warning'
order by
namespace,
last_timestamp;
select
namespace,
last_timestamp,
type,
reason,
involved_object || '/' || involved_object as object,
message
from
kubernetes_event
where
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,
path
from
kubernetes_event
where
path is not null;
select
namespace,
type,
reason,
involved_object || '/' || involved_object as object,
message,
path
from
kubernetes_event
where
path is not null;

Schema for kubernetes_event

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
actiontextWhat action was taken/failed with the regarding object.
annotationsjsonbAnnotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
context_nametextKubectl config context name.
countbigintThe number of times this event has occurred.
creation_timestamptimestamp with time zoneCreationTimestamp is a timestamp representing the server time when this object was created.
deletion_grace_period_secondsbigintNumber 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_timestamptimestamp with time zoneDeletionTimestamp is RFC 3339 date and time at which this resource will be deleted.
end_linebigintThe path to the manifest file.
event_timetimestamp with time zoneTime when this event was first observed.
finalizersjsonbMust 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_timestamptimestamp with time zoneThe time at which the event was first recorded.
generate_nametextGenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided.
generationbigintA sequence number representing a specific generation of the desired state.
involved_objectjsonbThe object that this event is about.
labelsjsonbMap 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_timestamptimestamp with time zoneTime when this event was last observed.
messagetextA description of the status of this operation.
nametextName of the object. Name must be unique within a namespace.
namespacetextNamespace defines the space within which each name must be unique.
owner_referencesjsonbList 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.
pathtextThe path to the manifest file.
reasontextThe reason the transition into the object's current status.
relatedjsonbOptional secondary object for more complex actions.
reporting_componenttextName of the controller that emitted this event.
reporting_instancetextID of the controller instance.
resource_versiontextAn opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed.
seriesjsonbData about the event series this event represents.
sourcejsonbThe component reporting this event.
source_typetextThe 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_nametextSteampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
start_linebigintThe path to the manifest file.
typetextType of this event (Normal, Warning), new types could be added in the future.
uidtextUID 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