From 29bf511ef9d3a9c8b97e16002a7d633aaa7d9725 Mon Sep 17 00:00:00 2001 From: Johan Thomsen Date: Mon, 29 Apr 2019 12:43:08 +0200 Subject: [PATCH] nixos/kubernetes: fix control-plane-online prestart dependency The kubeconfig provided to the kubernetes-control-plane-online.service is invalid. However, the apiserver /healthz endpoint can be accessed without auth so it's simpler to just use curl for that. --- nixos/modules/services/cluster/kubernetes/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/cluster/kubernetes/default.nix b/nixos/modules/services/cluster/kubernetes/default.nix index 192c893f8a16..5e46bfc4240f 100644 --- a/nixos/modules/services/cluster/kubernetes/default.nix +++ b/nixos/modules/services/cluster/kubernetes/default.nix @@ -273,11 +273,10 @@ in { wantedBy = [ "kube-control-plane-online.target" ]; after = [ "kube-scheduler.service" "kube-controller-manager.service" ]; before = [ "kube-control-plane-online.target" ]; - environment.KUBECONFIG = cfg.lib.mkKubeConfig "default" cfg.kubeconfig; - path = [ pkgs.kubectl ]; + path = [ pkgs.curl ]; preStart = '' - until kubectl get --raw=/healthz 2>/dev/null; do - echo kubectl get --raw=/healthz: exit status $? + until curl -Ssf ${cfg.apiserverAddress}/healthz do + echo curl -Ssf ${cfg.apiserverAddress}/healthz: exit status $? sleep 3 done '';