csi-driver
csi-driver copied to clipboard
Pods using the same PVC are scheduled on different nodes
Pods using the same PVC are scheduled on different nodes
I am using an existing Hetzner Cloud volume as base for a PersistentVolume. Then several pods use this volume and I expect them to be scheduled on the same K8S node but they don't and thus cannot be attached to the PersistentVolume. Only the pods that are scheduled on the node with the PV are able to run.
The PV and PVC are created like
apiVersion: v1
kind: PersistentVolume
metadata:
name: voltest
spec:
storageClassName: hcloud-volumes
accessModes:
- ReadWriteOnce
capacity:
storage: 10Gi
csi:
volumeHandle: "12345678"
driver: csi.hetzner.cloud
fsType: ext4
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: voltest
namespace: default
spec:
storageClassName: hcloud-volumes
accessModes:
- ReadWriteOnce
volumeName: voltest
resources:
requests:
storage: 10Gi
I found out that I can add NodeAffinity
to the PV but I expect this to be added by the CSI driver because only that knows on which node the volume will be mounted.
If only a single pod uses the PVC then it works OK. If I have a single node cluster and multiple pods use the same PVC it also works. But in multi node cluster with multiple pods using the same PVC it does not works as the pods are scheduled on different nodes.
I am using v1.6.0 of the hcloud csi driver.
Has anyone an idea how to fix that?