Azure / kubernetes-keyvault-flexvol

Azure keyvault integration with Kubernetes via a Flex Volume
MIT License
252 stars 84 forks source link

"/var/lib/kubelet/volumeplugins/azure~kv/kv: line 27: sudo: command not found #25

Closed hmm01i closed 6 years ago

hmm01i commented 6 years ago

Deployed the daemonset as documented and then tried to deploy the example nginx container from your example. The pod failed to create and I see this in the kubelet log:

I0808 23:20:18.050187    2077 reconciler.go:252] operationExecutor.MountVolume started for volume "test" (UniqueName: "flexvolume-azure/kv/d02f5840-9b42-11e8-9d86-000d3a3bcf16-test") pod "nginx-flex-kv-9f6c8c694-8b8v7" (UID: "d02f5840-9b42-11e8-9d86-000d3a3bcf16")
I0808 23:20:18.056681    2077 util.go:52] found flex volume secret info: clientid
I0808 23:20:18.056693    2077 util.go:52] found flex volume secret info: clientsecret
E0808 23:20:19.500751    2077 driver-call.go:251] Failed to unmarshal output for command: mount, output: "/var/lib/kubelet/volumeplugins/azure~kv/kv: line 27: sudo: command not found\n{\"status\": \"Success\"}\n", error: invalid character '/' looking for beginning of value
E0808 23:20:19.501033    2077 nestedpendingoperations.go:267] Operation for "\"flexvolume-azure/kv/d02f5840-9b42-11e8-9d86-000d3a3bcf16-test\" (\"d02f5840-9b42-11e8-9d86-000d3a3bcf16\")" failed. No retries permitted until 2018-08-08 23:22:21.5008958 +0000 UTC m=+70100.303765901 (durationBeforeRetry 2m2s). Error: "MountVolume.SetUp failed for volume \"test\" (UniqueName: \"flexvolume-azure/kv/d02f5840-9b42-11e8-9d86-000d3a3bcf16-test\") pod \"nginx-flex-kv-9f6c8c694-8b8v7\" (UID: \"d02f5840-9b42-11e8-9d86-000d3a3bcf16\") : invalid character '/' looking for beginning of value"

I checked and sudo is not available on that nginx image. I made a change to the ismounted() function in kv to bypass the sudo line and it worked.

Perhaps it would be sufficient to check for the presence of ${MNTPATH}.

I'll work on an alternative approach and submit a PR for you to review.