Home > Enterprise >  Mount smb-shares in the KNative service
Mount smb-shares in the KNative service

Time:09-17

I need to read file from smb:// share within Knative function. Is it possible?

I tried to mount share with Volumes (PersistentVolume/PersistentVolumeClaim). But seems Knative services don't support Volume functionality (supported volume types https://github.com/knative/docs/blob/51b878d8ebb494e48cfa5f4214defe92e85eb491/docs/serving/spec/knative-api-specification-1.0.md#volume).

Error description:

for: "service.yaml": 
error when patching "service.yaml": admission webhook "validation.webhook.serving.knative.dev" denied the request: 
validation failed: 
Persistent volume claim support is disabled, but found persistent volume claim pvc-smb:
Persistent volume write support is disabled, but found persistent volume claim pvc-smb that is not read-only:
must not set the field(s): spec.template.spec.volumes[0].persistentVolumeClaim

I also executed mount command within pod container. But also received an error:

mount -t cifs "//IP/SHARE" "/data" -o "username=debian"
Unable to apply new capability set.

CodePudding user response:

There is a feature flag kubernetes.podspec-persistent-volume-claim (and kubernetes.podspec-persistent-volume-write) which an administrator can use to enable mounting persistent volumes, including SMB shares.

These are disabled by default because volume mounts can impose scalability, performance, and correctness challenges for applications, and may restrict portability across clusters. There are some guard rails like this in Knative, with a goal of defaulting to more portable and less host-linked configuration.

  • Related