diff --git a/nixos/modules/services/cluster/kubernetes/addon-manager.nix b/nixos/modules/services/cluster/kubernetes/addon-manager.nix index abd9e99ba02a..46f5b68b2a5c 100644 --- a/nixos/modules/services/cluster/kubernetes/addon-manager.nix +++ b/nixos/modules/services/cluster/kubernetes/addon-manager.nix @@ -71,8 +71,8 @@ in systemd.services.kube-addon-manager = { description = "Kubernetes addon manager"; - wantedBy = [ "kubernetes.target" ]; - after = [ "kube-apiserver-online.target" "node-online.target" ]; + wantedBy = [ "kube-control-plane-online.target" ]; + before = [ "kube-control-plane-online.target" ]; environment.ADDON_PATH = "/etc/kubernetes/addons/"; path = [ pkgs.gawk ]; serviceConfig = { diff --git a/nixos/modules/services/cluster/kubernetes/apiserver.nix b/nixos/modules/services/cluster/kubernetes/apiserver.nix index 2e7e2a6ec3e8..e4650c12cff9 100644 --- a/nixos/modules/services/cluster/kubernetes/apiserver.nix +++ b/nixos/modules/services/cluster/kubernetes/apiserver.nix @@ -293,9 +293,9 @@ in in { systemd.services.kube-apiserver = { description = "Kubernetes APIServer Service"; - wantedBy = [ "kube-apiserver-online.target" ]; + wantedBy = [ "kube-control-plane-online.target" ]; after = [ "certmgr.service" ]; - before = [ "kube-apiserver-online.target" ]; + before = [ "kube-control-plane-online.target" ]; serviceConfig = { Slice = "kubernetes.slice"; ExecStart = ''${top.package}/bin/kube-apiserver \ @@ -461,16 +461,16 @@ in })) { - systemd.targets.kube-apiserver-online = { + systemd.targets.kube-control-plane-online = { wantedBy = [ "kubernetes.target" ]; before = [ "kubernetes.target" ]; }; - systemd.services.kube-apiserver-online = mkIf top.flannel.enable { - description = "apiserver control plane is online"; - wantedBy = [ "kube-apiserver-online.target" ]; + systemd.services.kube-control-plane-online = rec { + description = "Kubernetes control plane is online"; + wantedBy = [ "kube-control-plane-online.target" ]; after = [ "kube-scheduler.service" "kube-controller-manager.service" ]; - before = [ "kube-apiserver-online.target" ]; + before = [ "kube-control-plane-online.target" ]; preStart = '' ${top.lib.mkWaitCurl (with top.pki.certs.flannelClient; { sleep = 3; @@ -479,7 +479,7 @@ in inherit cert key; })} ''; - script = "echo apiserver control plane is online"; + script = "echo Ok"; serviceConfig = { TimeoutSec = "500"; }; diff --git a/nixos/modules/services/cluster/kubernetes/controller-manager.nix b/nixos/modules/services/cluster/kubernetes/controller-manager.nix index 20f471215dba..8e82db36425a 100644 --- a/nixos/modules/services/cluster/kubernetes/controller-manager.nix +++ b/nixos/modules/services/cluster/kubernetes/controller-manager.nix @@ -116,9 +116,9 @@ in systemd.services.kube-controller-manager = { description = "Kubernetes Controller Manager Service"; - wantedBy = [ "kube-apiserver-online.target" ]; + wantedBy = [ "kube-control-plane-online.target" ]; after = [ "kube-apiserver.service" ]; - before = [ "kube-apiserver-online.target" ]; + before = [ "kube-control-plane-online.target" ]; preStart = '' ${top.lib.mkWaitCurl (with top.pki.certs.controllerManagerClient; { sleep = 1; diff --git a/nixos/modules/services/cluster/kubernetes/kubelet.nix b/nixos/modules/services/cluster/kubernetes/kubelet.nix index 0b1d2a67565c..c4ecb2417e29 100644 --- a/nixos/modules/services/cluster/kubernetes/kubelet.nix +++ b/nixos/modules/services/cluster/kubernetes/kubelet.nix @@ -253,7 +253,7 @@ in systemd.services.kubelet = { description = "Kubernetes Kubelet Service"; wantedBy = [ "kubelet.target" ]; - after = [ "kube-apiserver-online.target" ]; + after = [ "kube-control-plane-online.target" ]; before = [ "kubelet.target" ]; path = with pkgs; [ gitMinimal openssh docker utillinux iproute ethtool thin-provisioning-tools iptables socat ] ++ top.path; preStart = '' @@ -339,7 +339,7 @@ in serviceConfig.Slice = "kubernetes.slice"; }; - systemd.services.node-online = { + systemd.services.kubelet-online = { wantedBy = [ "node-online.target" ]; after = [ "flannel.target" "kubelet.target" ]; before = [ "node-online.target" ]; diff --git a/nixos/modules/services/cluster/kubernetes/proxy.nix b/nixos/modules/services/cluster/kubernetes/proxy.nix index 073756d58abf..d13d23e997b7 100644 --- a/nixos/modules/services/cluster/kubernetes/proxy.nix +++ b/nixos/modules/services/cluster/kubernetes/proxy.nix @@ -48,9 +48,9 @@ in config = mkIf cfg.enable { systemd.services.kube-proxy = { description = "Kubernetes Proxy Service"; - wantedBy = [ "kubernetes.target" ]; - after = [ "node-online.target" ]; - before = [ "kubernetes.target" ]; + wantedBy = [ "node-online.target" ]; + after = [ "kubelet-online.service" ]; + before = [ "node-online.target" ]; path = with pkgs; [ iptables conntrack_tools ]; preStart = '' ${top.lib.mkWaitCurl (with top.pki.certs.kubeProxyClient; { diff --git a/nixos/modules/services/cluster/kubernetes/scheduler.nix b/nixos/modules/services/cluster/kubernetes/scheduler.nix index d3302a15402b..4aea9e9b6bd0 100644 --- a/nixos/modules/services/cluster/kubernetes/scheduler.nix +++ b/nixos/modules/services/cluster/kubernetes/scheduler.nix @@ -59,9 +59,9 @@ in config = mkIf cfg.enable { systemd.services.kube-scheduler = { description = "Kubernetes Scheduler Service"; - wantedBy = [ "kube-apiserver-online.target" ]; + wantedBy = [ "kube-control-plane-online.target" ]; after = [ "kube-apiserver.service" ]; - before = [ "kube-apiserver-online.target" ]; + before = [ "kube-control-plane-online.target" ]; preStart = '' ${top.lib.mkWaitCurl (with top.pki.certs.schedulerClient; { sleep = 1;