microsoft / K8s-Storage-Plugins

Storage plugins for Kubernetes
MIT License
42 stars 20 forks source link

SMB driver not working on Server 2019 #13

Closed csb1582 closed 5 years ago

csb1582 commented 5 years ago

SMB volumes will not mount to Pod on Windows. Flexvolume driver doesn't load correctly and this leaves the Pods stuck in ContainerCreating

deployment config- volumes:

kubectl describe pod output- Warning FailedMount 5s (x4 over 16s) kubelet, bcvmw19-kb-w3 MountVolume.SetUp failed for volume "data" : mount command failed, status: Failure, reason: Caught exception Invalid switch - "/". with stack at MakeSymLink, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\flexvolume.ps1: line 128 at mount_command, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\smb.ps1: line 33 at RunFlexVolume, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\flexvolume.ps1: line 273 at , C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\smb.ps1: line 52 at , : line 1

kubelet error log- E0607 21:04:22.274366 8616 driver-call.go:274] mount command failed, status: Failure, reason: Caught exception Invalid switch - "/". with stack at MakeSymLink, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\flexvolume.ps1: line 128 at mount_command, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\smb.ps1: line 33 at RunFlexVolume, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\flexvolume.ps1: line 273 at , C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\smb.ps1: line 52 at , : line 1 E0607 21:04:22.275363 8616 nestedpendingoperations.go:267] Operation for "\"flexvolume-microsoft.com/smb.cmd/586edf71-8989-11e9-b665-0050569e2770-data\" (\"586edf71-8989-11e9-b665-0050569e2770\")" failed. No retries permitted until 2019-06-07 21:04:22.7753634 -0400 EDT m=+8900.921073401 (durationBeforeRetry 500ms). Error: "MountVolume.SetUp failed for volume \"data\" (UniqueName: \"flexvolume-microsoft.com/smb.cmd/586edf71-8989-11e9-b665-0050569e2770-data\") pod \"inhouse-staging-8654dd7f7d-z7vh7\" (UID: \"586edf71-8989-11e9-b665-0050569e2770\") : mount command failed, status: Failure, reason: Caught exception Invalid switch - \"/\". with stack at MakeSymLink, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\flexvolume.ps1: line 128\r\nat mount_command, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\smb.ps1: line 33\r\nat RunFlexVolume, C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\flexvolume.ps1: line 273\r\nat , C:\usr\libexec\kubernetes\kubelet-plugins\volume\exec\microsoft.com~smb.cmd\smb.ps1: line 52\r\nat , : line 1"

Powershell execution policy set as follows- set-executionpolicy -scope localmachine bypass

This was needed as the driver didn't load at all before that.

Am I doing something wrong?

KnicKnic commented 5 years ago

Are you using a released version or master?

csb1582 commented 5 years ago

latest released version

KnicKnic commented 5 years ago

Latest released version does not fixup SMB paths specified in format //servername/path1/path2/... Master does, you can fix your source: //smb_server/share/folder to source: \\smb_server\share\folder to get around this till next version.

As far as execution bypass being needed. I didn't think this would have been necessary due to the scripts being signed. I will ensure the the bypass in the script launcher remains next release.

This is the difference from https://github.com/microsoft/K8s-Storage-Plugins/blob/master/flexvolume/windows/plugins/microsoft.com~smb.cmd/smb_prod.cmd and https://github.com/microsoft/K8s-Storage-Plugins/blob/master/flexvolume/windows/plugins/microsoft.com~smb.cmd/smb.cmd

csb1582 commented 5 years ago

I got it working using the Master. Thanks for your help! And for responding so quickly!

KnicKnic commented 5 years ago

Master was released today, so closing. The release should remove the need for you to set-execution policy