add kubernetes test for nfs mounts

This commit is contained in:
Pim Kunis 2024-03-22 22:19:44 +01:00
parent 217051981c
commit 9185beb663
3 changed files with 58 additions and 2 deletions

55
kubernetes/nfs-test.yaml Normal file
View file

@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: fedoratest
name: fedoratest
spec:
replicas: 2
selector:
matchLabels:
app: fedoratest
template:
metadata:
labels:
app: fedoratest
spec:
containers:
- image: registry.fedoraproject.org/fedora:35
name: fedora
command: ["/bin/bash", "-c", "--"]
args: ["while true; do sleep 30; done;"]
volumeMounts:
# name must match the volume name below
- name: media
mountPath: "/mnt/media"
volumes:
- name: media
persistentVolumeClaim:
claimName: media
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: media
spec:
capacity:
storage: 1Mi
accessModes:
- ReadWriteMany
nfs:
server: lewis.hyp
path: "/mnt/data/nfs/media"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: media
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 1Mi
volumeName: media

View file

@ -96,6 +96,7 @@
pciutils pciutils
dmidecode dmidecode
openssl openssl
nfs-utils
]; ];
nixpkgs.overlays = [ nixpkgs.overlays = [

View file

@ -33,7 +33,7 @@ let
nfsExports = lib.strings.concatLines ( nfsExports = lib.strings.concatLines (
builtins.map builtins.map
(share: (share:
"${cfg.nfsRoot}${share} 192.168.30.0/${config.lab.networking.dmz.ipv4.prefixLength}(rw,sync,no_subtree_check,no_root_squash)" "${cfg.nfsRoot}${share} 192.168.30.0/16(rw,sync,no_subtree_check,no_root_squash)"
) )
nfsShares nfsShares
); );
@ -66,7 +66,7 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
networking.firewall.interfaces.${config.lab.networking.dmz.bridgeName}.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
2049 # NFS 2049 # NFS
5432 # PostgeSQL 5432 # PostgeSQL
111 # NFS 111 # NFS