Skip to main content
Version: 3.3

Use of Ephemeral volumes

Generic Ephemeral volumes​

Generic ephemeral volumes also work with typical storage operations such as snapshotting, cloning, resizing, and storage capacity tracking.

The following steps will allow you to create a generic ephemeral volume with the Portworx CSI Driver.

In this example we are using the px-csi-db storage class out of the box. Please refer CSI Enabled Storage Classes for a list of available CSI enabled storage classes offered by Portworx.

  1. Create a pod spec that uses a Portworx CSI Driver StorageClass, declaring the ephemeral volume as seen below in a YAML file named ephemeral-volume-pod.yaml:

    kind: Pod
    apiVersion: v1
    metadata:
    name: my-app
    spec:
    containers:
    - name: my-frontend
    image: busybox
    volumeMounts:
    - mountPath: "/scratch"
    name: scratch-volume
    command: [ "sleep", "1000000" ]
    volumes:
    - name: scratch-volume
    ephemeral:
    volumeClaimTemplate:
    metadata:
    labels:
    type: my-frontend-volume
    spec:
    accessModes: [ "ReadWriteOnce" ]
    storageClassName: "px-csi-db"
    resources:
    requests:
    storage: 1Gi
  2. Apply the ephemeral-volume-pod.yaml spec to create the pod with a generic ephemeral volume:

    kubectl apply -f ephemeral-volume-pod.yaml
note

Ephemeral volumes are automatically deleted when the associated application pod is deleted.

Migration to CSI PVCs​

Currently, you cannot migrate or convert PVCs created using the native Kubernetes driver to the CSI driver. However, this is not required, and both types of PVCs can co-exist on the same cluster.

In this topic: