CSI inline ephemeral volumes
- Overview of CSI inline ephemeral volumes
- Embedding a CSI inline ephemeral volume in the Pod specification
Container Storage Interface (CSI) inline ephemeral volumes allow you to define a Pod
spec that creates inline ephemeral volumes when a pod is deployed and delete them when a pod is destroyed.
This feature is only available with supported Container Storage Interface (CSI) drivers.
CSI inline ephemeral volumes is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview/. |
Overview of CSI inline ephemeral volumes
Traditionally, volumes that are backed by Container Storage Interface (CSI) drivers can only be used with a PersistentVolume
and PersistentVolumeClaim
object combination.
This feature allows you to specify CSI volumes directly in the Pod
specification, rather than in a PersistentVolume
object. Inline volumes are ephemeral and do not persist across pod restarts.
Support limitations
By default, OKD supports CSI inline ephemeral volumes with these limitations:
Support is only available for CSI drivers. In-tree and FlexVolumes are not supported.
OKD does not include any CSI drivers. Use the CSI drivers provided by community or storage vendors. Follow the installation instructions provided by the CSI driver.
CSI drivers might not have implemented the inline volume functionality, including
Ephemeral
capacity. For details, see the CSI driver documentation.
Embedding a CSI inline ephemeral volume in the Pod specification
You can embed a CSI inline ephemeral volume in the Pod
specification in OKD. At runtime, nested inline volumes follow the ephemeral lifecycle of their associated pods so that the CSI driver handles all phases of volume operations as pods are created and destroyed.
Procedure
Create the
Pod
object definition and save it to a file.Embed the CSI inline ephemeral volume in the file.
my-csi-app.yaml
kind: Pod
apiVersion: v1
metadata:
name: my-csi-app
spec:
containers:
- name: my-frontend
image: busybox
volumeMounts:
- mountPath: "/data"
name: my-csi-inline-vol
command: [ "sleep", "1000000" ]
volumes: (1)
- name: my-csi-inline-vol
csi:
driver: inline.storage.kubernetes.io
volumeAttributes:
foo: bar
1 The name of the volume that is used by pods. Create the object definition file that you saved in the previous step.
$ oc create -f my-csi-app.yaml