From 0abf88e0d537be14c20aa622ec9931dea2b1dd45 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Sat, 23 Feb 2019 00:18:21 +0100 Subject: [PATCH] feat(testing): use host-local networking, instead of flannel for local cluster --- testing/default.nix | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/testing/default.nix b/testing/default.nix index ad5ddde..a845ad6 100644 --- a/testing/default.nix +++ b/testing/default.nix @@ -46,7 +46,7 @@ let allowedTCPPorts = [ 10250 # kubelet ]; - trustedInterfaces = ["docker0"]; + trustedInterfaces = ["docker0" "cni0"]; extraCommands = concatMapStrings (node: '' iptables -A INPUT -s ${node.config.networking.primaryIPAddress} -j ACCEPT @@ -88,6 +88,28 @@ let ip = "192.168.1.1"; }; }; + extraConfiguration = {...}: { + services.kubernetes.flannel.enable = false; + services.kubernetes.kubelet = { + networkPlugin = "cni"; + cni.config = [{ + name = "mynet"; + type = "bridge"; + bridge = "cni0"; + addIf = true; + ipMasq = true; + isGateway = true; + ipam = { + type = "host-local"; + subnet = "10.1.0.0/16"; + gateway = "10.1.0.1"; + routes = [{ + dst = "0.0.0.0/0"; + }]; + }; + }]; + }; + }; } // attrs // { name = "kubernetes-${attrs.name}-singlenode"; });