Kubetorch provides persistent storage through the Volume
class, which abstracts Kubernetes PersistentVolumeClaims
while maintaining the flexibility to work with any storage backend your cluster supports.
Manages persistent storage for Kubetorch services and deployments.
- __init__(name: str, size: str, storage_class: str | None = None, mount_path: str | None = None, access_mode: str | None = None, namespace: str | None = None, core_v1: CoreV1Api | None = None)
Get storage class - either specified or cluster default
Get existing volume or optionally create it
Get configuration for this volume
Convert to Kubernetes volume spec for pod template
Create PVC if it doesn’t exist
Delete the PVC
Check if the PVC exists
Launch an interactive debug shell with this volume mounted.
This method creates a temporary Kubernetes pod that mounts the PersistentVolumeClaim (PVC) backing this Volume at the same path (self.mount_path) used by Kubetorch services.
image (str, optional) – Container image to use for the debug pod. Must include a shell (e.g., alpine:3.18, ubuntu:22.04, or a custom tools image). Defaults to alpine:latest.
Example
>>> vol = Volume.from_name("kt-global-cache") >>> vol.ssh()