steampipe plugin install oci

Table: oci_container_instances_container_instance - Query OCI Container Engine for Kubernetes Container Instances using SQL

The OCI Container Engine for Kubernetes (OKE) is a fully-managed, scalable, and highly available service that you can use to deploy your containerized applications to the cloud. It provides developers with the ability to build, deploy, and manage cloud-native applications. It is an integral part of the Oracle Cloud Infrastructure platform, providing a seamless experience for managing your cloud infrastructure and applications.

Table Usage Guide

The oci_container_instances_container_instance table provides insights into container instances within OCI Container Engine for Kubernetes (OKE). As a DevOps engineer, you can explore specific details of your container instances through this table, including their metadata, status, and associated resources. Use this table to manage and monitor your containerized applications, ensuring their optimal performance and availability.

Examples

Basic info

Explore which container instances are available in your OCI environment. This query can help you assess the lifecycle state and creation time of each instance, and how many containers each instance is running, providing a quick overview of your OCI infrastructure.

select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance;
select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance;

List container instances created in the last 7 days

Explore which container instances have been created in the past week. This can be useful for tracking recent activity and managing resource allocation.

select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
time_created >= now() - interval '7' day;
select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
time_created >= datetime('now', '-7 day');

List failed container instances

Discover the segments that have failed container instances to assess potential issues and manage system resources more effectively. This can help in troubleshooting and maintaining the overall health of your infrastructure.

select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
lifecycle_state = 'FAILED';
select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
lifecycle_state = 'FAILED';

Get shape config details for container instances

Explore the configuration details of your container instances to understand their processing capabilities and network bandwidth. This can aid in resource management and optimization of your application's performance.

select
display_name,
lifecycle_state,
shape_config ->> 'ocpus' as ocpus,
shape_config ->> 'memoryInGBs' as memory_in_gbs,
shape_config ->> 'processorDescription' as processor_description,
shape_config ->> 'networkingBandwidthInGbps' as networking_bandwidth_in_gbps
from
oci_container_instances_container_instance;
select
display_name,
lifecycle_state,
json_extract(shape_config, '$.ocpus') as ocpus,
json_extract(shape_config, '$.memoryInGBs') as memory_in_gbs,
json_extract(shape_config, '$.processorDescription') as processor_description,
json_extract(shape_config, '$.networkingBandwidthInGbps') as networking_bandwidth_in_gbps
from
oci_container_instances_container_instance;

List container instances with no restart policy

Uncover the details of container instances that lack a restart policy, which may be crucial in maintaining service availability and preventing unforeseen downtime. This query is particularly useful for identifying potential vulnerabilities in system resilience.

select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
container_restart_policy = 'NEVER';
select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
container_restart_policy = 'NEVER';

Get DNS config details for container instances

Explore the DNS configuration details of your container instances to understand their lifecycle state and specific network settings. This can be useful in troubleshooting network issues or optimizing network performance.

select
display_name,
lifecycle_state,
dns_config -> 'nameservers' as nameservers,
dns_config -> 'searches' as searches,
dns_config -> 'options' as options
from
oci_container_instances_container_instance;
select
display_name,
lifecycle_state,
json_extract(dns_config, '$.nameservers') as nameservers,
json_extract(dns_config, '$.searches') as searches,
json_extract(dns_config, '$.options') as options
from
oci_container_instances_container_instance;

List container instances that are not attached to any volume

Identify container instances that are not linked to any volume in order to assess potential underutilization or misconfiguration. This can be useful for managing resources and optimizing your cloud infrastructure.

select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
volume_count is null;
select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
volume_count is null;

List container instances having more than one containers associated to it

Determine the areas in which a container instance has more than one associated container. This is useful for managing resources and troubleshooting potential issues in configurations.

select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
container_count > 1;
select
display_name,
id,
availability_domain,
lifecycle_state,
time_created,
container_count
from
oci_container_instances_container_instance
where
container_count > 1;

Schema for oci_container_instances_container_instance

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
availability_domaintext=Availability Domain where the Container Instance is running.
compartment_idtext=The OCID of the compartment in Tenant in which the resource is located.
container_countbigintThe number of containers running on the instance.
container_restart_policytextThe container restart policy is applied for all containers in container instance.
containersjsonbThe Containers on this Instance.
defined_tagsjsonbDefined tags for resource. Defined tags are set up in your tenancy by an administrator. Only users granted permission to work with the defined tags can apply them to resources.
display_nametext=Display name for the Container Instance.
dns_configjsonbDNS Config of the container instance.
fault_domaintextFault Domain where the ContainerInstance is running.
freeform_tagsjsonbFree-form tags for resource. This tags can be applied by any user with permissions on the resource.
graceful_shutdown_timeout_in_secondsbigintDuration in seconds processes within a Container have to gracefully terminate. This applies whenever a Container must be halted, such as when the Container Instance is deleted.
idtext=Unique identifier that is immutable on creation.
image_pull_secretsjsonbThe image pull secrets for accessing private registry to pull images for containers.
lifecycle_detailstextA message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state.
lifecycle_statetext=The current state of the Container Instance.
regiontextThe OCI region in which the resource is located.
shapetextThe shape of the Container Instance. The shape determines the resources available to the Container Instance.
shape_configjsonbThe shape config of the Container Instance.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
system_tagsjsonbSystem tags for resource. System tags can be viewed by users, but can only be created by the system.
tagsjsonbA map of tags for the resource.
tenant_idtext=, !=, ~~, ~~*, !~~, !~~*The OCID of the Tenant in which the resource is located.
time_createdtimestamp with time zoneThe time the the Container Instance was created.
time_updatedtimestamp with time zoneThe time the ContainerInstance was updated.
titletextTitle of the resource.
vnicsjsonbThe virtual networks available to containers running on this Container Instance.
volume_countbigintThe number of volumes that attached to this Instance.
volumesjsonbA Volume represents a directory with data that is accessible across multiple containers in a ContainerInstance.

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)" -- oci

You can pass the configuration to the command with the --config argument:

steampipe_export_oci --config '<your_config>' oci_container_instances_container_instance