OpenShift + Steampipe
OpenShift is a container platform that provides a scalable and secure environment for deploying, managing, and scaling applications based on Kubernetes, enabling organizations to develop and run applications more efficiently and reliably.
Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.
List your OpenShift projects:
select name, uid, phase, creation_timestamp, resource_versionfrom openshift_project;
+--------------------------------------------------+--------------------------------------+--------+---------------------------+------------------+| name | uid | phase | creation_timestamp | resource_version |+--------------------------------------------------+--------------------------------------+--------+---------------------------+------------------+| openshift-authentication | cf62541e-1ad0-45f6-b023-cf695f32bffd | Active | 2023-06-05T17:45:53+05:30 | 6659 || openshift-apiserver | fb619658-fbb2-4735-87fe-386fa2897816 | Active | 2023-06-05T17:45:49+05:30 | 6650 || openshift-backplane-csa | 693ce132-49a7-4e00-b295-29de6be2fca7 | Active | 2023-06-05T18:07:01+05:30 | 30294 |+--------------------------------------------------+--------------------------------------+--------+---------------------------+------------------+
Documentation
Quick start
Install
Download and install the latest OpenShift plugin:
steampipe plugin install openshift
Credentials
No credentials are required.
Configuration
Installing the latest openshift plugin will create a config file (~/.steampipe/config/openshift.spc
) with a single connection named openshift
:
Configure your account details in ~/.steampipe/config/openshift.spc
:
connection "openshift" { plugin = "openshift"
# By default, the plugin will use credentials in "~/.kube/config" with the current context. # The kubeconfig path and context can also be specified with the following config arguments:
# Specify the file path to the kubeconfig. If not set, the plugin will check `~/.kube/config`. # Can also be set with the "KUBE_CONFIG" or "KUBECONFIG" environment variables. # config_path = "~/.kube/config"
# Specify a context other than the current one. If not set, the current context will be used. Optional. # config_context = "default/api-openshift-test-dq1i-p2-openshiftapps-com:6443/test"}
Configuring OpenShift Credentials
By default, the plugin will use the kubeconfig in ~/.kube/config
with the current context. If using the default oc CLI configurations, the kubeconfig will be in this location and the OpenShift plugin connections will work by default.
You can also set the kubeconfig file path and context with the config_path
and config_context
config arguments respectively.
)
Postgres FDW
This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- openshift
The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.
To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.
CREATE EXTENSION IF NOT EXISTS steampipe_postgres_openshift;CREATE SERVER steampipe_openshift FOREIGN DATA WRAPPER steampipe_postgres_openshift OPTIONS (config '<your_config>');CREATE SCHEMA openshift;IMPORT FOREIGN SCHEMA openshift FROM SERVER steampipe_openshift INTO openshift;
SQLite Extension
This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- openshift
The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.
To configure the SQLite extension, load the extension module and then run the steampipe_configure_openshift
function to configure it with plugin-specific options.
$ sqlite3sqlite> .load ./steampipe_sqlite_extension_openshift.sosqlite> select steampipe_configure_openshift('<your_config>');
Export
This plugin is available as a standalone Export 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>' <table_name>