canonical / microk8s

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.
https://microk8s.io
Apache License 2.0
8.54k stars 773 forks source link

NFS Volumes not working on microk8s with strict confinement #4660

Open Naegionn opened 2 months ago

Naegionn commented 2 months ago

Summary

I am trying to use standard (non PV) nfs volumes on my strict microk8s 1.29 Installation (accroding to charmed kubeflow installation) I have nfs file shares that are shared between multiple systems some of them without k8s. These shared need to be mounted as simple nfs volume to some pods.

volumes:
      - name: shared-storage
        nfs:
          server: shared-storage.local
          path: /pool/share1

On the host I have nfs-common installed but it cant be used likely due to strict confinement.

Events:
  Type     Reason       Age                  From     Message
  ----     ------       ----                 ----     -------
  Warning  FailedMount  17s (x65 over 116m)  kubelet  MountVolume.SetUp failed for volume "shared-storage" : mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t nfs shared-storgage.local:/pool/share1 /var/snap/microk8s/common/var/lib/kubelet/pods/2c4d03f0-ff66-460f-838c-5b222d8628e2/volumes/kubernetes.io~nfs/shared-storage
Output: mount: /var/snap/microk8s/common/var/lib/kubelet/pods/2c4d03f0-ff66-460f-838c-5b222d8628e2/volumes/kubernetes.io~nfs/shared-storage: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.

Trying to link nfs-mount to microk8s does not work:

lukas@yavin1:~$ sudo snap connect microk8s:nfs-mount                                                                                                                                                                                                                          error: snap "microk8s" has no plug named "nfs-mount"                                                                                                                                                                                                                                    

What Should Happen Instead?

I expect microk8s to mount the nfs volume, maybe after I have executed connect:microk8s:nfs-mount

Reproduction Steps

  1. Install microk8s sudo snap install microk8s --channel=1.29-strict/stable
  2. Install sudo apt install nfs-common
  3. Apply deployment manifest that is using nfs volume
  4. It does not work
  5. Try linking microk8s and nfs-mount, it does not work either

Introspection Report

Can you suggest a fix?

Allow strict confinement to use nfs-volume. maybe by a connection

Are you interested in contributing with a fix?

Yes, but I dont know how

Naegionn commented 1 month ago

Hey this is still an issue for me, some input would be appreciated