Pod Inline Volume Support


StatusMin K8s VersionMax K8s Version


Traditionally, volumes that are backed by CSI drivers can only be used with a PersistentVolume and PersistentVolumeClaim object combination. This feature supports ephemeral storage use cases and allows CSI volumes to be specified directly in the pod specification. At runtime, nested inline volumes follow the ephemeral lifecycle of their associated pods where the driver handles all phases of volume operations as pods are created and destroyed.

See the design document for futher information.

Example of inline CSI pod spec

A pod spec with an ephemeral inline CSI volume. Note that because the volume is expected to be ephemeral, the volumeHandle is not provided. Instead, an ID will be generated by kubelet as volume is mounted for pod use. The generated ID is passed to the CSI driver at NodePublish.

apiVersion: v1
kind: Pod
  name: some-pod
      - name: vol
          driver: inline.storage.kubernetes.io
              foo: bar

Implementing inline ephemeral support

Drivers must be modified (or implemented specifically) to support inline ephemeral workflows. When Kubernetes encounters an inline CSI volume embedded in a pod spec, it treats that volume differently. Mainly, the driver will only receive NodePublish, during the volume's mount phase, and NodeUnpublish when the pod is going away and the volume is unmounted. To support inline, a driver must implement the followings:

  • Identity service
  • Node service

Kubernetes 1.16 only allows using a CSI driver for an inline volume if its CSIDriverInfo object explicitly declares that the driver supports that kind of usage in its volumeLifecycleModes field. This is a safeguard against accidentally using a driver the wrong way.

Feature gates

To use inline volume, Kubernetes 1.15 binaries must start with the CSIInlineVolume feature gate enabled:


Kubernetes >= 1.16 no longer needs this as the feature is enabled by default.

Example implementation

  • CSI Hostpath driver - an example driver that supports both modes and determines the mode on a case-by-case basis (for Kubernetes 1.16) or can be deployed with support for just one of the two modes (for Kubernetes 1.15).
  • Image populator plugin - an example CSI driver plugin that uses a container image as a volume.