turbot/kubernetes

steampipe plugin install kubernetessteampipe plugin install kubernetes

Table: kubernetes_job

A Job creates one or more Pods and will continue to retry execution of the Pods until a specified number of them successfully terminate.

Examples

Basic Info

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,
annotations
from
kubernetes_job;

List active jobs

select
name,
namespace,
start_time,
age(coalesce(completion_time, current_timestamp), start_time) as duration,
active,
succeeded,
failed
from
kubernetes_job
where active > 0;

List failed jobs

select
name,
namespace,
start_time,
age(coalesce(completion_time, current_timestamp), start_time) as duration,
active,
succeeded,
failed
from
kubernetes_job
where failed > 0;

Get list of container and images for jobs

select
name,
namespace,
jsonb_agg(elems.value -> 'name') as containers,
jsonb_agg(elems.value -> 'image') as images
from
kubernetes_job,
jsonb_array_elements(template -> 'spec' -> 'containers') as elems
group by
name,
namespace;

.inspect kubernetes_job

A Job creates one or more Pods and will continue to retry execution of the Pods until a specified number of them successfully terminate.

NameTypeDescription
activebigintThe number of actively running pods.
active_deadline_secondsbigintThe duration in seconds relative to the startTime that the job may be active before the system tries to terminate it.
annotationsjsonbAnnotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
backoff_limitbigintThe number of retries before marking this job failed. Defaults to 6.
completion_timetimestamp without time zoneTime when the job was completed.
completionsbigintThe desired number of successfully finished pods the job should be run with.
conditionsjsonbThe latest available observations of an object's current state.
context_nametextKubectl config context name.
creation_timestamptimestamp without 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 without time zoneDeletionTimestamp is RFC 3339 date and time at which this resource will be deleted.
failedbigintThe number of pods which reached phase Failed.
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.
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.
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.
manual_selectorbooleanManualSelector controls generation of pod labels and pod selectors. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsible for picking unique labels and specifying the selector.
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.
parallelismbigintThe maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism.
resource_versiontextAn opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed.
selectorjsonbA label query over pods that should match the pod count.
start_timetimestamp without time zoneTime when the job was acknowledged by the job controller.
succeededbigintThe number of pods which reached phase Succeeded.
tagsjsonbA map of tags for the resource. This includes both labels and annotations.
templatejsonbDescribes the pod that will be created when executing a job.
titletextTitle of the resource.
ttl_seconds_after_finishedbigintlimits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted.
uidtextUID is the unique in time and space value for this object.