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_countfrom oci_container_instances_container_instance;
select display_name, id, availability_domain, lifecycle_state, time_created, container_countfrom 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_countfrom oci_container_instances_container_instancewhere time_created >= now() - interval '7' day;
select display_name, id, availability_domain, lifecycle_state, time_created, container_countfrom oci_container_instances_container_instancewhere 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_countfrom oci_container_instances_container_instancewhere lifecycle_state = 'FAILED';
select display_name, id, availability_domain, lifecycle_state, time_created, container_countfrom oci_container_instances_container_instancewhere 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_gbpsfrom 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_gbpsfrom 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_countfrom oci_container_instances_container_instancewhere container_restart_policy = 'NEVER';
select display_name, id, availability_domain, lifecycle_state, time_created, container_countfrom oci_container_instances_container_instancewhere 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 optionsfrom 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 optionsfrom 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_countfrom oci_container_instances_container_instancewhere volume_count is null;
select display_name, id, availability_domain, lifecycle_state, time_created, container_countfrom oci_container_instances_container_instancewhere 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_countfrom oci_container_instances_container_instancewhere container_count > 1;
select display_name, id, availability_domain, lifecycle_state, time_created, container_countfrom oci_container_instances_container_instancewhere container_count > 1;
Schema for oci_container_instances_container_instance
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
availability_domain | text | = | Availability Domain where the Container Instance is running. |
compartment_id | text | = | The OCID of the compartment in Tenant in which the resource is located. |
container_count | bigint | The number of containers running on the instance. | |
container_restart_policy | text | The container restart policy is applied for all containers in container instance. | |
containers | jsonb | The Containers on this Instance. | |
defined_tags | jsonb | Defined 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_name | text | = | Display name for the Container Instance. |
dns_config | jsonb | DNS Config of the container instance. | |
fault_domain | text | Fault Domain where the ContainerInstance is running. | |
freeform_tags | jsonb | Free-form tags for resource. This tags can be applied by any user with permissions on the resource. | |
graceful_shutdown_timeout_in_seconds | bigint | Duration 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. | |
id | text | = | Unique identifier that is immutable on creation. |
image_pull_secrets | jsonb | The image pull secrets for accessing private registry to pull images for containers. | |
lifecycle_details | text | A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state. | |
lifecycle_state | text | = | The current state of the Container Instance. |
region | text | The OCI region in which the resource is located. | |
shape | text | The shape of the Container Instance. The shape determines the resources available to the Container Instance. | |
shape_config | jsonb | The shape config of the Container Instance. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
system_tags | jsonb | System tags for resource. System tags can be viewed by users, but can only be created by the system. | |
tags | jsonb | A map of tags for the resource. | |
tenant_id | text | =, !=, ~~, ~~*, !~~, !~~* | The OCID of the Tenant in which the resource is located. |
time_created | timestamp with time zone | The time the the Container Instance was created. | |
time_updated | timestamp with time zone | The time the ContainerInstance was updated. | |
title | text | Title of the resource. | |
vnics | jsonb | The virtual networks available to containers running on this Container Instance. | |
volume_count | bigint | The number of volumes that attached to this Instance. | |
volumes | jsonb | A 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