enable k3s cluster
add simple kubenix script
This commit is contained in:
parent
cc809942ef
commit
4f41fd746a
5 changed files with 132 additions and 3 deletions
3
cluster/README.md
Normal file
3
cluster/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
```
|
||||
nix --extra-experimental-features nix-command --extra-experimental-features flakes run .#kubenix
|
||||
```
|
99
cluster/flake.lock
Normal file
99
cluster/flake.lock
Normal file
|
@ -0,0 +1,99 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"kubenix": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems",
|
||||
"treefmt": "treefmt"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1700116223,
|
||||
"narHash": "sha256-Pld/UXlBcIDnQMY0JkDzChJkbof/zEcRkaiXtzvArEE=",
|
||||
"owner": "hall",
|
||||
"repo": "kubenix",
|
||||
"rev": "e4d036576436b9983216584a89388af3da995043",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hall",
|
||||
"repo": "kubenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1686488075,
|
||||
"narHash": "sha256-2otSBt2hbeD+5yY25NF3RhWx7l5SDt1aeU3cJ/9My4M=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9401a0c780b49faf6c28adf55764f230301d0dce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"kubenix": "kubenix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "systems",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"treefmt": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"kubenix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1688026376,
|
||||
"narHash": "sha256-qJmkr9BWDpqblk4E9/rCsAEl39y2n4Ycw6KRopvpUcY=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "df3f32b0cc253dfc7009b7317e8f0e7ccd70b1cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
22
cluster/flake.nix
Normal file
22
cluster/flake.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
inputs.kubenix.url = "github:hall/kubenix";
|
||||
outputs = { self, kubenix, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
in {
|
||||
kubenix = kubenix.packages.${system}.default.override {
|
||||
module = {kubenix, ...}: {
|
||||
imports = [kubenix.modules.k8s];
|
||||
kubernetes = {
|
||||
kubeconfig = "/etc/rancher/k3s/k3s.yaml";
|
||||
version = "1.24";
|
||||
};
|
||||
kubenix.project = "yeet";
|
||||
|
||||
kubernetes.resources.pods.web1.spec.containers.nginx.image = "nginx";
|
||||
kubernetes.resources.pods.web2.spec.containers.nginx.image = "nginx";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -109,6 +109,7 @@
|
|||
dig
|
||||
tree
|
||||
file
|
||||
k3s
|
||||
];
|
||||
|
||||
networking = {
|
||||
|
@ -169,10 +170,11 @@
|
|||
};
|
||||
};
|
||||
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
hardware.cpu.intel.updateMicrocode =
|
||||
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
age.identityPaths = [ "/root/age_ed25519" ];
|
||||
|
||||
services.k3s.enable = true;
|
||||
services.k3s.role = "server";
|
||||
}
|
||||
|
|
|
@ -5,17 +5,20 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
deploy-rs.url = "github:serokell/deploy-rs";
|
||||
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
agenix = {
|
||||
url = "github:ryantm/agenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, deploy-rs, disko, agenix, nixpkgs-unstable, ... }:
|
||||
outputs =
|
||||
{ self, nixpkgs, deploy-rs, disko, agenix, nixpkgs-unstable, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
|
Loading…
Reference in a new issue