k3s pvc test
This commit is contained in:
parent
6207af6aef
commit
1cbae0c65f
3 changed files with 86 additions and 1 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
{ cfg, lib, inputs, ... }:
|
{ cfg, lib, inputs, ... }:
|
||||||
let
|
let
|
||||||
manifests = [
|
manifests = [
|
||||||
|
./nfs.nix
|
||||||
|
./ubuntu-test.nix
|
||||||
];
|
];
|
||||||
imported = map ( n: import n { inherit cfg lib inputs; } ) manifests;
|
imported = map ( n: import n { inherit cfg lib inputs; } ) manifests;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
50
modules/k3s/deployments/nfs.nix
Normal file
50
modules/k3s/deployments/nfs.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
nfsMain.content = [
|
||||||
|
{
|
||||||
|
apiVersion = "v1";
|
||||||
|
kind = "PersistentVolume";
|
||||||
|
metadata = {
|
||||||
|
name = "nfsMainPV";
|
||||||
|
};
|
||||||
|
spec = {
|
||||||
|
capacity = {
|
||||||
|
storage = "100Gi";
|
||||||
|
};
|
||||||
|
accessModes = [
|
||||||
|
"ReadWriteMany"
|
||||||
|
];
|
||||||
|
storageClassName = "";
|
||||||
|
persistentVolumeReclaimPolicy = "Retain";
|
||||||
|
volumeMode = "Filesystem";
|
||||||
|
mountOptions = [
|
||||||
|
"hard"
|
||||||
|
"nfsvers=4.1"
|
||||||
|
];
|
||||||
|
nfs = {
|
||||||
|
server = "poseidon.nyxerinys.dev";
|
||||||
|
path = "/containers";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
apiVersion = "v1";
|
||||||
|
kind = "PersistentVolumeClaim";
|
||||||
|
metadata = {
|
||||||
|
name = "nfsMainPVC";
|
||||||
|
};
|
||||||
|
spec = {
|
||||||
|
accessModes = [
|
||||||
|
"ReadWriteMany"
|
||||||
|
];
|
||||||
|
storageClassName = "";
|
||||||
|
resources = {
|
||||||
|
requests = {
|
||||||
|
storage = "100Gi"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
volumeName = "nfsMainPV";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
34
modules/k3s/deployments/ubuntu-test.nix
Normal file
34
modules/k3s/deployments/ubuntu-test.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
ubuntu-test.content = [
|
||||||
|
{
|
||||||
|
apiVersion = "v1";
|
||||||
|
kind = "Pod";
|
||||||
|
metadata.name = "ubuntu";
|
||||||
|
spec = {
|
||||||
|
containers = [
|
||||||
|
{
|
||||||
|
name = "ubuntu";
|
||||||
|
image = "ubuntu:latest";
|
||||||
|
command = [ "tail" "-f" "/dev/null" ];
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
mountPath = "/test";
|
||||||
|
name = "test";
|
||||||
|
subPath = "ubuntu-test"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
{
|
||||||
|
name = "test";
|
||||||
|
persistentVolumeClaim = {
|
||||||
|
claimName = "nfsMainPVC";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue