Table: openshift_deployment_config - Query OpenShift Deployment Configs using SQL
OpenShift Deployment Configs are a feature of OpenShift, a Kubernetes distribution from Red Hat. Deployment Configs define the template for a pod and manage the deployment of new pod versions when the template changes. They provide detailed control over the lifecycle of deployments, including strategies for rolling updates, manual intervention, and rollback.
Table Usage Guide
The openshift_deployment_config
table provides insights into Deployment Configs within OpenShift. As a DevOps engineer or system administrator, explore deployment-specific details through this table, including triggers, strategies, and information about the latest deployments. Utilize it to manage and monitor the deployment of new pod versions in an OpenShift cluster.
Examples
Basic info
Explore the status and details of different deployment configurations within an OpenShift environment. This allows for efficient monitoring and management of resources, ensuring optimal application performance and availability.
select uid, name, namespace, spec_replicas ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_config;
select uid, name, namespace, spec_replicas, ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_config;
List deployment configs present in the default namespace
Explore the deployment configurations within the default namespace to understand the status and availability of replicas. This can be useful for managing resources and identifying potential issues in your OpenShift environment.
select uid, name, namespace, spec_replicas ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_configwhere namespace = 'default';
select uid, name, namespace, spec_replicas, ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_configwhere namespace = 'default';
List paused deployment configs
Discover the segments that have paused deployment configurations. This can help in identifying instances where updates or changes have been halted, allowing for quick resolution of issues that may be causing the pause.
select uid, name, namespace, spec_replicas ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_configwhere paused;
select uid, name, namespace, spec_replicas, ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_configwhere paused = 1;
List deployment configs created in the last 30 days
Identify recent deployment configurations within the past month to understand their status and performance. This can be beneficial in monitoring system health and identifying potential issues early.
select uid, name, namespace, spec_replicas ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_configwhere creation_timestamp >= now() - interval '30' day;
select uid, name, namespace, spec_replicas, ready_replicas, updated_replicas, available_replicas, unavailable_replicas, creation_timestampfrom openshift_deployment_configwhere creation_timestamp >= datetime('now', '-30 day');
Get container images used in deployment configs
Discover the specific container images used in your deployment configurations. This allows you to assess and manage your resource usage and maintain an inventory of your deployed images.
select name, namespace, c ->> 'name' as container_name, c ->> 'image' as imagefrom openshift_deployment_config, jsonb_array_elements(template -> 'Spec' -> 'Containers') as corder by namespace, name;
select name, namespace, json_extract(c.value, '$.name') as container_name, json_extract(c.value, '$.image') as imagefrom openshift_deployment_config, json_each(json_extract(template, '$.Spec.Containers')) as corder by namespace, name;
List pods for a particular deployment config
This query helps you to monitor and manage your Kubernetes deployment by listing all the pods associated with a specific deployment configuration. It's particularly useful when you need to track the status and location of pods within a particular deployment, such as troubleshooting issues or optimizing resource allocation.
select pod.namespace, d.name as deployment_config_name, rc.name as replication_controller_name, pod.name as pod_name, pod.phase, age(current_timestamp, pod.creation_timestamp), pod.pod_ip, pod.node_namefrom kubernetes_pod as pod, jsonb_array_elements(pod.owner_references) as pod_owner, kubernetes_replication_controller as rc, jsonb_array_elements(rc.owner_references) as rc_owner, openshift_deployment_config as dwhere pod_owner ->> 'kind' = 'ReplicationController' and rc.uid = pod_owner ->> 'uid' and rc_owner ->> 'uid' = d.uid and d.name = 'sample-deployment'order by pod.namespace, d.name, rc.name, pod.name;
select pod.namespace, d.name as deployment_config_name, rc.name as replication_controller_name, pod.name as pod_name, pod.phase, ( strftime('%s', 'now') - strftime('%s', pod.creation_timestamp) ) as age, pod.pod_ip, pod.node_namefrom kubernetes_pod as pod, json_each(pod.owner_references) as pod_owner, kubernetes_replication_controller as rc, json_each(rc.owner_references) as rc_owner, openshift_deployment_config as dwhere json_extract(pod_owner.value, '$.kind') = 'ReplicationController' and rc.uid = json_extract(pod_owner.value, '$.uid') and json_extract(rc_owner.value, '$.uid') = d.uid and d.name = 'sample-deployment'order by pod.namespace, d.name, rc.name, pod.name;
List deployment config with access to the host process ID, IPC, or network
Discover the deployment configurations that have access to the host process ID, IPC, or network. This is useful for identifying potential security risks in your Openshift environment.
select namespace, name, template -> 'spec' ->> 'hostPID' as hostPID, template -> 'spec' ->> 'hostIPC' as hostIPC, template -> 'spec' ->> 'hostNetwork' as hostNetworkfrom openshift_deployment_configwhere template -> 'spec' ->> 'hostPID' = 'true' or template -> 'spec' ->> 'hostIPC' = 'true' or template -> 'spec' ->> 'hostNetwork' = 'true';
select namespace, name, json_extract(template, '$.spec.hostPID') as hostPID, json_extract(template, '$.spec.hostIPC') as hostIPC, json_extract(template, '$.spec.hostNetwork') as hostNetworkfrom openshift_deployment_configwhere json_extract(template, '$.spec.hostPID') = 'true' or json_extract(template, '$.spec.hostIPC') = 'true' or json_extract(template, '$.spec.hostNetwork') = 'true';
Schema for openshift_deployment_config
Name | Type | Operators | Description |
---|---|---|---|
Details | jsonb | Details are the reasons for the update to this deployment config. | |
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
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. | |
available_replicas | bigint | The total number of available pods targeted by this deployment config. | |
conditions | jsonb | Conditions represent the latest available observations of a deployment config's current state. | |
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. | |
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. | |
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. | |
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. | |
latest_version | bigint | LatestVersion is used to determine whether the current deployment associated with a deployment config is out of sync. | |
min_ready_seconds | bigint | MinReadySeconds is the minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. | |
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. |
observed_generation | bigint | ObservedGeneration is the most recent generation observed by the deployment config controller. | |
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. | |
paused | boolean | Paused indicates that the deployment config is paused resulting in no new deployments on template changes or changes in the template caused by other triggers. | |
ready_replicas | bigint | Total number of ready pods targeted by this deployment. | |
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. | |
revision_history_limit | bigint | RevisionHistoryLimit is the number of old ReplicationControllers to retain to allow for rollbacks. This field is a pointer to allow for differentiation between an explicit zero and not specified. Defaults to 10. | |
selector | jsonb | Selector is a label query over pods that should match the Replicas count. | |
spec_replicas | bigint | Replicas is the number of desired replicas. | |
status_replicas | bigint | Replicas is the total number of pods targeted by this deployment config. | |
strategy | jsonb | Strategy describes how a deployment is executed. | |
template | jsonb | Template is the object that describes the pod that will be created if insufficient replicas are detected. | |
test | boolean | Test ensures that this deployment config will have zero replicas except while a deployment is running. | |
title | text | Title of the resource. | |
triggers | jsonb | Triggers determine how updates to a DeploymentConfig result in new deployments. If no triggers are defined, a new deployment can only occur as a result of an explicit client update to the DeploymentConfig with a new LatestVersion. If null, defaults to having a config change trigger. | |
uid | text | UID is the unique in time and space value for this object. | |
unavailable_replicas | bigint | The total number of unavailable pods targeted by this deployment config. | |
updated_replicas | bigint | The total number of non-terminated pods targeted by this deployment config that has the desired template spec. |
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)" -- openshift
You can pass the configuration to the command with the --config
argument:
steampipe_export_openshift --config '<your_config>' openshift_deployment_config