Table: kubernetes_storage_class - Query Kubernetes Storage Classes using SQL
A Storage Class in Kubernetes is a way to describe different types of storage that are available in a Kubernetes cluster. Storage Classes are used to dynamically provision storage, based on the class of storage requested by a Persistent Volume Claim. They are essential for managing storage resources and ensuring that the right type of storage is available for different workloads.
Table Usage Guide
The kubernetes_storage_class
table provides insights into the Storage Classes within a Kubernetes cluster. As a Kubernetes administrator, you can explore details about each Storage Class through this table, including the provisioner, reclaim policy, and volume binding mode. Utilize it to manage and optimize storage resources in your cluster, ensuring that the right type of storage is available for different workloads.
Examples
Basic Info
Explore which storage classes are available in your Kubernetes environment, including their provisioners, reclaim policies, and mount options. This can be useful to understand how your storage resources are configured and managed.
select name, provisioner, reclaim_policy, parameters, mount_optionsfrom kubernetes_storage_class;
select name, provisioner, reclaim_policy, parameters, mount_optionsfrom kubernetes_storage_class;
List storage classes that don't allow volume expansion
Explore which storage classes in a Kubernetes environment do not support volume expansion. This is useful for identifying potential storage limitations in your system.
select name, allow_volume_expansion, provisioner, reclaim_policy, parameters, mount_optionsfrom kubernetes_storage_classwhere not allow_volume_expansion;
select name, allow_volume_expansion, provisioner, reclaim_policy, parameters, mount_optionsfrom kubernetes_storage_classwhere allow_volume_expansion = 0;
List storage classes with immediate volume binding mode enabled
Explore which storage classes have immediate volume binding mode enabled. This is beneficial for understanding the storage configurations that allow immediate access to volumes, which can be crucial for certain applications and workloads.
select name, allow_volume_expansion, provisioner, reclaim_policy, volume_binding_modefrom kubernetes_storage_classwhere volume_binding_mode = 'Immediate';
select name, allow_volume_expansion, provisioner, reclaim_policy, volume_binding_modefrom kubernetes_storage_classwhere volume_binding_mode = 'Immediate';
List manifest resources
Explore the configuration of storage classes in a Kubernetes environment to understand which ones have defined paths for storing data. This is useful in identifying potential storage optimization opportunities or troubleshooting storage-related issues.
select name, provisioner, reclaim_policy, parameters, mount_options, pathfrom kubernetes_storage_classwhere path is not null;
select name, provisioner, reclaim_policy, parameters, mount_options, pathfrom kubernetes_storage_classwhere path is not null;
Schema for kubernetes_storage_class
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
allow_volume_expansion | boolean | AllowVolumeExpansion shows whether the storage class allows volume expand. | |
allowed_topologies | jsonb | Restrict the node topologies where volumes can be dynamically provisioned. Each volume plugin defines its own supported topology specifications. An empty TopologySelectorTerm list means there is no topology restriction. | |
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. | |
context_name | text | Kubectl config context name. | |
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. | |
end_line | bigint | The path to the manifest file. | |
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. | |
mount_options | jsonb | Dynamically provisioned PersistentVolumes of this storage class are created with these mountOptions, e.g. ['ro', 'soft']. Not validated - mount of the PVs will simply fail if one is invalid. | |
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. | |
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. | |
parameters | jsonb | Parameters holds the parameters for the provisioner that should create volumes of this storage class. | |
path | text | The path to the manifest file. | |
provisioner | text | Provisioner indicates the type of the provisioner. | |
reclaim_policy | text | Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete. | |
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. | |
source_type | text | The source of the resource. Possible values are: deployed and manifest. If the resource is fetched from the spec file the value will be manifest. | |
sp_connection_name | text | Steampipe connection name. | |
sp_ctx | jsonb | Steampipe context in JSON form. | |
start_line | bigint | The path to the manifest file. | |
title | text | Title of the resource. | |
uid | text | UID is the unique in time and space value for this object. | |
volume_binding_mode | text | VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is only honored by servers that enable the VolumeScheduling feature. |
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)" -- kubernetes
You can pass the configuration to the command with the --config
argument:
steampipe_export_kubernetes --config '<your_config>' kubernetes_storage_class