mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 17:38:29 +02:00
feat(hosts,lib): use kube-vip for k3s's HA
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
# the first node in the cluster should be the one to initialize the cluster
|
||||
clusterInit = true;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
...
|
||||
}: let
|
||||
hostName = "k3s-prod-1-master-2"; # define your hostname.
|
||||
k3sServerName = "k3s-prod-1-master-1";
|
||||
|
||||
coreModule = mylib.genKubeVirtCoreModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -16,7 +15,9 @@
|
||||
inherit pkgs;
|
||||
kubeconfigFile = "/home/${myvars.username}/.kube/config";
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
...
|
||||
}: let
|
||||
hostName = "k3s-prod-1-master-3"; # define your hostname.
|
||||
k3sServerName = "k3s-prod-1-master-1";
|
||||
|
||||
coreModule = mylib.genKubeVirtCoreModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -16,7 +15,9 @@
|
||||
inherit pkgs;
|
||||
kubeconfigFile = "/home/${myvars.username}/.kube/config";
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
...
|
||||
}: let
|
||||
hostName = "k3s-prod-1-worker-1"; # define your hostname.
|
||||
k3sServerName = "k3s-prod-1-master-1";
|
||||
|
||||
coreModule = mylib.genKubeVirtCoreModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -15,7 +14,9 @@
|
||||
k3sModule = mylib.genK3sAgentModule {
|
||||
inherit pkgs;
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
...
|
||||
}: let
|
||||
hostName = "k3s-prod-1-worker-2"; # define your hostname.
|
||||
k3sServerName = "k3s-prod-1-master-1";
|
||||
|
||||
coreModule = mylib.genKubeVirtCoreModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -15,7 +14,9 @@
|
||||
k3sModule = mylib.genK3sAgentModule {
|
||||
inherit pkgs;
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
...
|
||||
}: let
|
||||
hostName = "k3s-prod-1-worker-3"; # define your hostname.
|
||||
k3sServerName = "k3s-prod-1-master-1";
|
||||
|
||||
coreModule = mylib.genKubeVirtCoreModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -15,7 +14,9 @@
|
||||
k3sModule = mylib.genK3sAgentModule {
|
||||
inherit pkgs;
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
# the first node in the cluster should be the one to initialize the cluster
|
||||
clusterInit = true;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "test-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
...
|
||||
}: let
|
||||
hostName = "k3s-test-1-master-2"; # define your hostname.
|
||||
k3sServerName = "k3s-test-1-master-1";
|
||||
|
||||
coreModule = mylib.genKubeVirtCoreModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -16,7 +15,9 @@
|
||||
inherit pkgs;
|
||||
kubeconfigFile = "/home/${myvars.username}/.kube/config";
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "test-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
...
|
||||
}: let
|
||||
hostName = "k3s-test-1-master-3"; # define your hostname.
|
||||
k3sServerName = "k3s-test-1-master-1";
|
||||
|
||||
coreModule = mylib.genKubeVirtCoreModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -16,7 +15,9 @@
|
||||
inherit pkgs;
|
||||
kubeconfigFile = "/home/${myvars.username}/.kube/config";
|
||||
tokenFile = config.age.secrets."k3s-prod-1-token".path;
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "test-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
tokenFile = "/run/media/nixos_k3s/kubevirt-k3s-token";
|
||||
# the first node in the cluster should be the one to initialize the cluster
|
||||
clusterInit = true;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "kubevirt-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
inherit pkgs;
|
||||
kubeconfigFile = "/home/${myvars.username}/.kube/config";
|
||||
tokenFile = "/run/media/nixos_k3s/kubevirt-k3s-token";
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "kubevirt-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
inherit pkgs;
|
||||
kubeconfigFile = "/home/${myvars.username}/.kube/config";
|
||||
tokenFile = "/run/media/nixos_k3s/kubevirt-k3s-token";
|
||||
serverIp = myvars.networking.hostsAddr.${k3sServerName}.ipv4;
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "kubevirt-cluster-1.writefor.fun";
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
Reference in New Issue
Block a user