rke2 master & add

This commit is contained in:
Evan Reichard 2025-01-26 17:07:18 -05:00
parent 4130b78323
commit 0c6060def2
6 changed files with 133 additions and 9 deletions

View File

@ -3,7 +3,7 @@
## Copy Config
```bash
scp -r * nixos@10.10.10.10:/tmp/
scp -r * root@10.10.10.10:/etc/nixos
```
## Partition Drives
@ -17,21 +17,20 @@ sudo nix \
--experimental-features "nix-command flakes" \
run github:nix-community/disko -- \
--mode disko \
--flake /tmp#lin-va-rke1
--flake /etc/nixos#lin-va-rke1
```
## Install NixOS
```bash
# Install
sudo nixos-install --flake /tmp#lin-va-llama1
sudo nixos-install --flake /tmp#lin-va-rke1
sudo nixos-install --flake /etc/nixos#lin-va-rke1
# Reboot
sudo reboot
```
## Copy Config to Host
## Copy Config Back to Host
```bash
scp -r * nixos@10.10.10.10:/etc/nixos
@ -42,3 +41,17 @@ scp -r * nixos@10.10.10.10:/etc/nixos
```bash
sudo nixos-rebuild switch
```
# Install Kubernetes (RKE2)
```
# Deploy First Node
sudo nixos-install --flake /etc/nixos#lin-va-rke1
# Reboot & Get Token
cat /var/lib/rancher/rke2/server/node-token
# Deploy Following Nodes
echo "<TOKEN>" > ./k8s/rke2-token
sudo nixos-install --flake /etc/nixos#lin-va-rke2
```

View File

@ -34,7 +34,7 @@
];
};
# RKE2 Server
# RKE2 Primary Server
nixosConfigurations.lin-va-rke1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
@ -42,8 +42,62 @@
./hosts/rke2.nix
{
networking.hostName = "lin-va-rke1";
disko.devices.disk.main.device = "/dev/nvme0n1";
k8s.diskPoolID = "/dev/disk/by-id/ata-INTEL_SSDSC2BW240A4_CVDA418201Z42403GN";
# Partitions
disko.devices.disk.main.device = "/dev/disk/by-id/ata-VBOX_HARDDISK_VB0af7d668-04b70404";
k8s.diskPoolID = "/dev/disk/by-id/ata-VBOX_HARDDISK_VBcd9425b8-d666f9b8";
}
];
};
# RKE2 Second Server
nixosConfigurations.lin-va-rke2 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
./hosts/rke2.nix
{
networking.hostName = "lin-va-rke2";
# Partitions
disko.devices.disk.main.device = "/dev/disk/by-id/ata-VBOX_HARDDISK_VBf55aaccc-688cfd0d";
k8s.diskPoolID = "/dev/disk/by-id/ata-VBOX_HARDDISK_VBfd391256-6e368424";
# Set RKE2 Join
services.rke2.serverAddr = "https://10.0.20.147:9345";
services.rke2.tokenFile = "/etc/rancher/rke2/node-token";
environment.etc."rancher/rke2/node-token" = {
source = ./k8s/rke2-token;
mode = "0600";
user = "root";
group = "root";
};
}
];
};
# RKE2 Third Server
nixosConfigurations.lin-va-rke3 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
./hosts/rke2.nix
{
networking.hostName = "lin-va-rke3";
# Partitions
disko.devices.disk.main.device = "/dev/disk/by-id/ata-VBOX_HARDDISK_VBe9edacd5-ac4ed4fa";
k8s.diskPoolID = "/dev/disk/by-id/ata-VBOX_HARDDISK_VBa1fc46d0-19380495";
# Set RKE2 Join
services.rke2.serverAddr = "https://10.0.20.147:9345";
services.rke2.tokenFile = "/etc/rancher/rke2/node-token";
environment.etc."rancher/rke2/node-token" = {
source = ./k8s/rke2-token;
mode = "0600";
user = "root";
group = "root";
};
}
];
};

View File

@ -96,10 +96,10 @@
"openebs.io/engine=mayastor"
];
role = "server";
# -------------------
# --- Server Node ---
# -------------------
role = "server";
# -------------------
# --- Worker Node ---

1
k8s/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
rke2-token

51
k8s/config/kasten.yaml Normal file
View File

@ -0,0 +1,51 @@
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: va-unraid-backup-rw
spec:
capacity:
storage: 100Ti
accessModes:
- ReadWriteMany
storageClassName: "va-unraid-backup-rw"
persistentVolumeReclaimPolicy: "Retain"
mountOptions:
- "vers=4.2,proto=tcp,port=2049"
nfs:
server: 10.0.20.180
path: "/mnt/user/KubernetesBackup"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: va-unraid-backup-rw
namespace: kasten
spec:
accessModes:
- ReadWriteMany
storageClassName: "va-unraid-backup-rw"
resources:
requests:
storage: 100Ti
---
apiVersion: v1
kind: Namespace
metadata:
labels:
name: kasten
name: kasten
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: k10
namespace: kube-system
spec:
repo: https://charts.kasten.io/
chart: k10
targetNamespace: kasten
valuesContent: |-
global:
persistence:
storageClass: mayastor-r1

View File

@ -18,11 +18,16 @@
deps = [ ];
text = ''
mkdir -p ${config.k8s.manifestsDir}
# Storage - OpenEBS
cp ${pkgs.substituteAll {
src = ./config/openebs.yaml;
nodeName = config.networking.hostName;
diskPoolID = config.k8s.diskPoolID;
}} ${config.k8s.manifestsDir}/openebs.yaml
# Backup - Kasten
cp ${./config/kasten.yaml} ${config.k8s.manifestsDir}/kasten.yaml
'';
};
};