Skip to content

Commit c4f8c3f

Browse files
committed
Fix volume reconstruction in standalone mode Kubelet in standalone mode won't have kubeclient, it cannot get node.status and get devices from it. Such a kubelet cannot mount attachable volumes anyway.
1 parent c8f001d commit c4f8c3f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/kubelet/volumemanager/reconciler/reconstruct_new.go

+8
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ func (rc *reconciler) cleanOrphanVolumes() {
180180
func (rc *reconciler) updateReconstructedDevicePaths() {
181181
klog.V(4).InfoS("Updating reconstructed devicePaths")
182182

183+
if rc.kubeClient == nil {
184+
// Skip reconstructing devicePath from node objects if kubelet is in standalone mode.
185+
// Such kubelet is not expected to mount any attachable volume or Secrets / ConfigMap.
186+
klog.V(2).InfoS("Skipped reconstruction of DevicePaths from node.status in standalone mode")
187+
rc.volumesNeedDevicePath = nil
188+
return
189+
}
190+
183191
node, fetchErr := rc.kubeClient.CoreV1().Nodes().Get(context.TODO(), string(rc.nodeName), metav1.GetOptions{})
184192
if fetchErr != nil {
185193
// This may repeat few times per second until kubelet is able to read its own status for the first time.

0 commit comments

Comments
 (0)