Skip to content

Commit 462db17

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#57475 from stmcginnis/iscsi_node_startup
Automatic merge from submit-queue (batch tested with PRs 57399, 57751, 57475). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. iscsi: set node.startup to manual If the default iSCSI node.startup is set to automatic, if there is a node failure, any pods on that node will get rescheduled to another node. If the failed node is later brought back up it will then try to log back in to any iSCSI sessions it had prior to the failure, which may no longer exist or may be now in-use by the other nodes. It appears most platforms keep the open-iscsi default of node.startup-automatic. But in case this system-wide setting has been changed, and just to be explicit, this sets node.startup values for kubernetes controlled volumes to manual. Fixes kubernetes#21305 ```release-note iSCSI sessions managed by kubernetes will now explicitly set startup.mode to 'manual' to prevent automatic login after node failure recovery. This is the default open-iscsi mode, so this change will only impact users who have changed their startup.mode to be 'automatic' in /etc/iscsi/iscsid.conf. ```
2 parents 9ec4430 + 9f97d61 commit 462db17

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/volume/iscsi/iscsi_util.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) {
279279
lastErr = fmt.Errorf("iscsi: failed to attach disk: Error: %s (%v)", string(out), err)
280280
continue
281281
}
282+
// in case of node failure/restart, explicitly set to manual login so it doesn't hang on boot
283+
out, err = b.exec.Run("iscsiadm", "-m", "node", "-p", tp, "-T", b.Iqn, "-o", "update", "node.startup", "-v", "manual")
284+
if err != nil {
285+
// don't fail if we can't set startup mode, but log warning so there is a clue
286+
glog.Warningf("Warning: Failed to set iSCSI login mode to manual. Error: %v", err)
287+
}
282288
if exist := waitForPathToExist(&devicePath, 10, iscsiTransport); !exist {
283289
glog.Errorf("Could not attach disk: Timeout after 10s")
284290
// update last error

0 commit comments

Comments
 (0)