attempt at nfs docker

This commit is contained in:
2025-01-13 21:28:47 -07:00
parent a2771afe2d
commit 0ae62c3020
7 changed files with 66 additions and 7 deletions

View File

@@ -0,0 +1,7 @@
# sources
nix instructions <https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/cluster/k3s/README.md>

1
kubernetes/nfs-server/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
test/

View File

@@ -0,0 +1,13 @@
FROM alpine:latest
RUN apk add --no-cache nfs-utils bash
RUN mkdir -p /exports
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 2049 20048
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

View File

@@ -0,0 +1,24 @@
#!/bin/bash
set -e
ALLOWED_CLIENTS="${ALLOWED_CLIENTS:-*}"
echo "/exports $ALLOWED_CLIENTS(rw,sync,no_subtree_check,no_root_squash)" > /etc/exports
rpcbind || true
rpc.statd || true
echo "Starting NFS server..."
mount -t nfsd nfsd /proc/fs/nfsd
rpc.nfsd -N 3 -V 4 --grace-time 10 $nfsd_debug_opt &
rpc.mountd -N 2 -N 3 -V 4 --foreground $mountd_debug_opt &
wait
# rpc.mountd -N 2 -N 3 -V 4 --foreground
# wait

View File

@@ -0,0 +1,19 @@
<https://wiki.alpinelinux.org/wiki/Setting_up_an_NFS_server>
example docker run
```bash
docker run --rm -it \
--name nfs-server \
--cap-add SYS_ADMIN \
-e ALLOWED_CLIENTS="127.0.0.1.0/24" \
-v (pwd)/test:/exports \
--network host \
nfs-server
```
currently not working, i like the idea of running the nfs server in a docker container, but doing it as a nixos module is probably better

View File

@@ -1,6 +0,0 @@
# sources
https://ranchermanager.docs.rancher.com/pages-for-subheaders/install-upgrade-on-a-kubernetes-cluster
install r3k for manager cluster: https://docs.k3s.io/quick-start