Install longhorn on k3s

Introduce new storage standard with LVM
This commit is contained in:
Pim Kunis 2024-05-18 23:32:58 +02:00
parent 7e14a2cc13
commit a21a09ad6b
9 changed files with 257 additions and 69 deletions

View file

@ -15,7 +15,7 @@ let
./media.nix
./bind9
./dnsmasq.nix
./minecraft.nix
# ./minecraft.nix
./blog.nix
./atticd.nix
./argo.nix
@ -25,6 +25,7 @@ in
imports = [
./base.nix
./custom-types.nix
./longhorn.nix
./esrom.nix
./metallb.nix
./cert-manager.nix

View file

@ -93,6 +93,7 @@
lab = {
ingresses.atticd = {
host = "attic.kun.is";
entrypoint = "localsecure";
service = {
name = "atticd";

View file

@ -17,7 +17,14 @@
web.containerPort = 9000;
smtp.containerPort = 2500;
};
volumeMounts = [{
name = "storage";
mountPath = "/storage";
}];
};
volumes.storage.persistentVolumeClaim.claimName = "inbucket";
};
};
};
@ -44,6 +51,12 @@
}];
};
};
persistentVolumeClaims.inbucket.spec = {
accessModes = [ "ReadWriteOnce" ];
storageClassName = "longhorn";
resources.requests.storage = "30Mi";
};
};
lab.ingresses.inbucket = {

View file

@ -0,0 +1,52 @@
{ nixhelm, system, ... }: {
config = {
kubernetes = {
helm.releases.longhorn = {
chart = nixhelm.chartsDerivations.${system}.longhorn.longhorn;
includeCRDs = true;
values = {
defaultSettings = {
defaultDataPath = "/mnt/longhorn";
storageMinimalAvailablePercentage = 0;
};
persistence = {
defaultClassReplicaCount = 2;
};
};
};
resources = {
ingresses.longhorn = {
metadata.annotations = {
"cert-manager.io/cluster-issuer" = "letsencrypt";
"traefik.ingress.kubernetes.io/router.entrypoints" = "localsecure";
};
spec = {
ingressClassName = "traefik";
rules = [{
host = "longhorn.kun.is";
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "longhorn-frontend";
port.number = 80;
};
}];
}];
tls = [{
secretName = "longhorn-tls";
hosts = [ "longhorn.kun.is" ];
}];
};
};
};
};
};
}