Kubernetes Volume Tracking

Since Polycrate API 0.15.0, PersistentVolumes in Kubernetes clusters are tracked as K8sVolume objects synced by the Polycrate Operator, covering tracked metadata, UI views, orphaned volumes, productization and billing.

Kubernetes Volume Tracking

Overview

Since Polycrate API 0.15.0, PersistentVolumes in Kubernetes clusters are captured, tracked and used for billing as standalone Polycrate objects (K8sVolume). This makes the following visible:

  • How many volumes are running where?
  • Which volumes belong to which K8sApp / which namespace?
  • How old are they, how large, in what state?
  • Which ones are released / orphaned / bound?
  • What do they cost?

K8sVolume is maintained exclusively by the Polycrate Operator (CLI) – users do not create them manually. The operator synchronizes PersistentVolumes in the cluster with the Polycrate API.


What data is tracked?

For each PersistentVolume the Polycrate API receives the following metadata:

Field Example Meaning
name pvc-abc-123 Kubernetes PV name
k8s_cluster → K8sCluster Cluster assignment
k8s_app → K8sApp (optional) App derived from PVC namespace/labels
namespace production Namespace of the associated PVC
storage_class longhorn, ceph-rbd, hcloud-volumes StorageClass
capacity_bytes 107374182400 (100 GiB) Requested size
phase Bound, Released, Available Kubernetes PV phase
access_modes [RWO], [RWX] Access modes
reclaim_policy Delete, Retain Reclaim behavior
pvc_name / pvc_namespace data-postgres-0 / production Bound claim
provider_object_name / _id technical K8s identifiers For cluster sync
cloud_provider_volume_id CSI volumeHandle / cloud volume ID Matching for provider status / incidents
csi_driver CSI driver name Identification of the storage backend

cloud_provider_volume_id is populated by the operator from the PV and enables the mapping of provider outages to specific volumes — see Incidents and DataSources.


Where do I see volumes?

  • Kubernetes → Volumes – central list of all volumes with filters by cluster, StorageClass, phase, app
  • K8sCluster detail → Volumes tab – volumes of a single cluster
  • K8sApp detail → Volumes tab – volumes of an app (from PVC labels/namespace)

Each volume has a detail view with:

  • Overview (capacity, phase, age)
  • Associated PVC and app
  • History (size changes, phase transitions)
  • Billing information

Orphaned & Released Volumes

A Released volume (reclaim_policy=Retain, PVC was deleted but data retained) remains visible as a Polycrate K8sVolume. This covers typical backup/recovery scenarios and prevents such volumes from "invisibly" incurring costs.

Filters for operational cleanup:

  • phase=Released – data exists but nobody uses it
  • phase=Available – provisioned but never bound
  • age > 90d + phase != Bound – candidates for cleanup

Productization & Billing

Since 0.15.0, K8sVolume is a productized model with product kind block-storage. On the first sync, the product configured in System Config → Default K8sVolume Product is assigned automatically. This makes volumes part of regular Polycrate billing.

Depending on the product, pricing can be:

  • Flat rate per volume (e.g. per GiB-month)
  • Tiered pricing via PricingRule
  • Custom per organization via OrganizationProduct

Configuration details: Pricing & Business Layer.


Prerequisite: Operator Sync

For volumes to appear in the API, the Polycrate Operator must be running in the cluster. The operator:

  1. Watches all PersistentVolume objects in the cluster
  2. Creates a Polycrate K8sVolume for each PV via API call
  3. Keeps status, phase and PVC assignment up to date
  4. Removes K8sVolumes from the API when the PV is actually deleted in the cluster (stale sweep)

Sync interval and label filters are configurable via the OperatorConfig in the cluster.


See also