Pod Info on Mount
|Status||Min K8s Version||Max K8s Version||cluster-driver-registrar Version|
CSI avoids encoding Kubernetes specific information in to the specification, since it aims to support multiple orchestration systems (beyond just Kubernetes).
This can be problematic because some CSI drivers require information about the workload (e.g. which pod is referencing this volume), and CSI does not provide this information natively to drivers.
Pod Info on Mount with CSI Driver Object
The CSIDriver Object enables CSI Drivers to specify how Kubernetes should interact with it.
podInfoOnMount field instructs Kubernetes that the CSI driver requires additional pod information (like podName, podUID, etc.) during mount operations.
For example, the existence of the following object would cause Kubernetes to add pod information at mount time to the
apiVersion: storage.k8s.io/v1beta1 kind: CSIDriver metadata: name: testcsidriver.example.com spec: podInfoOnMount: true
podInfoOnMount field is set to
true, during mount, Kubelet will add the following key/values to the
publish_context field in the CSI
The CSIDriver object should be manually included in the driver manifests.
Previously, the cluster-driver-registrar sidecar container could be used to create the object. Once the flags to this container are configured correctly, it will automatically create a CSIDriver Object when it starts with the correct fields set.
In alpha, this feature was enabled by setting the
podInfoOnMountVersion field in the
CSIDriver Object CRD to to
apiVersion: csi.storage.k8s.io/v1alpha1 kind: CSIDriver metadata: name: testcsidriver.example.com spec: podInfoOnMountVersion: v1