Repository navigation
Node is not made primary when PVC is attached to new node #942
Copy link
Copy link
Open
Description
I am seeing that some resources are not made primary on the new node when a pod for example goes from node02 to node03.
The pod fails to mount the volume, causing it to be stuck in ContainerCreating:
MountVolume.SetUp failed for volume "pvc-08c8e34a-ad2a-4394-ac5c-db0b48e927f7" : rpc error: code = Internal desc = NodePublishVolume failed for pvc-08c8e34a-ad2a-4394-ac5c-db0b48e927f7: failed to set source device readwrite: exit status 1
Inside Kubernetes the volume attachment is correct:
apiVersion: storage.k8s.io/v1
kind: VolumeAttachment
metadata:
annotations:
csi.alpha.kubernetes.io/node-id: node02
creationTimestamp: "2026-01-19T01:04:40Z"
finalizers:
- external-attacher/linstor-csi-linbit-com
name: csi-4ba15d6efb8bb7a7d9581a240d5bedd57b96b9a2bb7a873423da8182d05d0322
resourceVersion: "31936834"
uid: e74f54ad-e7d8-4b0b-9249-8f94113d643a
spec:
attacher: linstor.csi.linbit.com
nodeName: node02
source:
persistentVolumeName: pvc-08c8e34a-ad2a-4394-ac5c-db0b48e927f7
status:
attached: true
attachmentMetadata:
linstor.csi.linbit.com/device-path: /dev/drbd1017
linstor.csi.linbit.com/fs-type: xfs
linstor.csi.linbit.com/uses-publish-context: "true"But the resource is still primary on node03, as indicated by the PVC annotation and drbdadm status:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
pv.kubernetes.io/bind-completed: "yes"
pv.kubernetes.io/bound-by-controller: "yes"
volume.beta.kubernetes.io/storage-provisioner: linstor.csi.linbit.com
volume.kubernetes.io/selected-node: node03
volume.kubernetes.io/storage-provisioner: linstor.csi.linbit.com
creationTimestamp: "2026-01-11T23:30:00Z"
finalizers:
- kubernetes.io/pvc-protection
- snapshot.storage.kubernetes.io/pvc-as-source-protection
labels:
kustomize.toolkit.fluxcd.io/name: apps-media
kustomize.toolkit.fluxcd.io/namespace: flux-system
name: radarr-config
namespace: media
resourceVersion: "28820599"
uid: 08c8e34a-ad2a-4394-ac5c-db0b48e927f7
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: pool1
volumeMode: Filesystem
volumeName: pvc-08c8e34a-ad2a-4394-ac5c-db0b48e927f7
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 2Gi
phase: Bound[root@node01:~]# drbdadm status pvc-08c8e34a-ad2a-4394-ac5c-db0b48e927f7
pvc-08c8e34a-ad2a-4394-ac5c-db0b48e927f7 role:Secondary
disk:Diskless open:no
node02 role:Secondary
peer-disk:UpToDate
node03 role:Primary
peer-disk:UpToDate
I can resolve this manually by making the current primary into secondary and then promoting the other node to primary.
Unsure if this is the LINSTOR project or part of Piraeus.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
WanzenBug commentedon Jan 20, 2026
We generally use the DRBD "auto-promote" feature. That means that on using "mount /dev/drbd...", the DRBD device becomes primary, and on "umount /..." the device switches back to secondary.
I'm not aware of any bugs in DRBD in that area. However, if you manually promote a node to Primary (using
drbdadm primary ...) you then also have to manually rundrbdadm secondary ..... Manual promotion disables the auto-promote feature.So if you manually promote a resource, you kind of break the CSI driver, as it then does not automatically demote after unmounting.
mikkel1156 commentedon Jan 20, 2026
I did not know that it breaks the promotion. It's possible I have messed around with it while creating it and that is why it's broken, I'm not seeing that issue for other volumes (only this one and another).
Is there a way to fix it, eg. can I set auto-promote on the resource again?
mikkel1156 commentedon Jan 21, 2026
Just tried setting the auto-promote option on the resource definition, but no luck. It gets set but has no effect on the issue.
Checked if the current primary still has it mounted somehow, but it doesnt appear so when checking with
lsblk | grep drbd1013.WanzenBug commentedon Jan 22, 2026
I don't think there is a command that can reset this flag, sadly.
mikkel1156 commentedon Jan 22, 2026
Would it then be best to create this an issue to LINSTOR server for a possible solution from their side?
It seems like I am forced to delete the whole resource/PVC and create it again with data from backup to get it to act normally again.
WanzenBug commentedon Jan 22, 2026
No need to go to those extremes. What you need to to:
InUse?drbdadm secondary ...from the satellite.What I meant with the flag not resetting is that when you run
drbdadm primary ...you can not get the auto-demote until you manually randrbdadm secondary ...again after all mounts are gone.mikkel1156 commentedon Jan 22, 2026
I totally misunderstood you, apologies.
Doing as you said solves my issue.
kvaps commentedon Apr 29, 2026
We are hitting this exact behavior on a freshly provisioned PVC in
Cozystack e2e CI runs (Talos sandbox, kernel 6.x, drbd-utils 9.x,
piraeus-operator from current cozystack chart).
Repro is more aggressive than the original report — no pod migration
is involved. The PVC is provisioned, mounted exactly once, and ends
up stuck because the LINSTOR resource was promoted to Primary on a
node that never had a consumer.
Setup
placementCount: 3replicated, freshvlstorage-generic-0StatefulSet pod(pod UID unchanged for 28+ minutes)
State
LINSTOR view:
CSI on srv1 retries
NodePublishVolumeevery ~2 minutes, each timefailing with the canonical:
Why this matters
The previous report was closed because the
drbdadm secondaryworkaround restored access. But the underlying race is still there
and trips up CI deterministically: it is reproducible on a fresh
sandbox where no pod ever migrated and no failover ever happened.
A volume that comes up
Primaryon a node that never had a consumerindicates auto-promote firing during the provisioning path
(
mkfs.ext4against a freshly created replica) without the matchingauto-demote when the path closes. Once that flag is set, only an
explicit
drbdadm secondaryresets it, and there is no automationfor that.
Closely related: piraeusdatastore/linstor-csi#172 (open) describes
the same symptom on bulk PVC creation.
Workaround that worked for us
CSI on the target node then promotes locally on the next retry and
the pod attaches.
Asks
open:noAND no matching VolumeAttachment on this node" and demoteautomatically?
open:nomakes this a safe operation.drbdadm secondaryon close, regardless of how the path exits?Reopening because the upstream code state is unchanged and the issue
keeps recurring across users.
fix(linstor): plunger demotes idle-Primary DRBD resources (#2539)
fix(linstor): plunger demotes idle-Primary DRBD resources