Configure clustering with k3s
This commit is contained in:
parent
31267fa34c
commit
2249b4cc58
4 changed files with 14 additions and 1 deletions
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
networking.hostName = "kube01"; # Define your hostname.
|
networking.hostName = "kube01"; # Define your hostname.
|
||||||
|
|
||||||
|
services.k3s = {
|
||||||
|
clusterInit = true;
|
||||||
|
};
|
||||||
|
|
||||||
# This option defines the first version of NixOS you have installed on this particular machine,
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@
|
||||||
|
|
||||||
networking.hostName = "kube02"; # Define your hostname.
|
networking.hostName = "kube02"; # Define your hostname.
|
||||||
|
|
||||||
|
services.k3s = {
|
||||||
|
serverAddr = "https://kube01:6443";
|
||||||
|
clusterInit = false;
|
||||||
|
};
|
||||||
|
|
||||||
# This option defines the first version of NixOS you have installed on this particular machine,
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
# Most users should NEVER change this value after the initial install, for any reason,
|
# Most users should NEVER change this value after the initial install, for any reason,
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@
|
||||||
|
|
||||||
networking.hostName = "kube03"; # Define your hostname.
|
networking.hostName = "kube03"; # Define your hostname.
|
||||||
|
|
||||||
|
services.k3s = {
|
||||||
|
serverAddr = "https://kube01:6443";
|
||||||
|
clusterInit = false;
|
||||||
|
};
|
||||||
|
|
||||||
# This option defines the first version of NixOS you have installed on this particular machine,
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
services.k3s = {
|
services.k3s = {
|
||||||
enable = true;
|
enable = true;
|
||||||
role = "server";
|
role = "server";
|
||||||
clusterInit = true;
|
|
||||||
token = "verysecrettoken";
|
token = "verysecrettoken";
|
||||||
extraFlags = toString ([
|
extraFlags = toString ([
|
||||||
"--write-kubeconfig-mode \"0644\""
|
"--write-kubeconfig-mode \"0644\""
|
||||||
|
|
@ -19,6 +18,8 @@
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [
|
networking.firewall.allowedTCPPorts = [
|
||||||
6443
|
6443
|
||||||
|
2379
|
||||||
|
2380
|
||||||
];
|
];
|
||||||
networking.firewall.allowedUDPPorts = [
|
networking.firewall.allowedUDPPorts = [
|
||||||
8472
|
8472
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue