From cd4bdade626549aaa8d6e65ef762bf0de18282c6 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sat, 13 Mar 2021 12:47:54 +0000 Subject: [PATCH] Patch the flannel to utilise host-gw. --- .../modules/networking-flannel/main.tf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/step3/infrastructure/modules/networking-flannel/main.tf b/step3/infrastructure/modules/networking-flannel/main.tf index 81125b4..1da2dba 100644 --- a/step3/infrastructure/modules/networking-flannel/main.tf +++ b/step3/infrastructure/modules/networking-flannel/main.tf @@ -11,4 +11,19 @@ resource "null_resource" "flannel_networking" { when = destroy command = "kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml" } +} + +resource "null_resource" "flannel_networking_patch" { + depends_on = [ null_resource.flannel_networking ] + provisioner = "local-exec" { + when = create + command = << EOF +kubectl patch configmap kube-flannel-cfg -n kube-system -p '{ + "data": { + "net-conf.json": "{\r\n\t\"Network\": \"10.244.0.0/16\",\r\n\t\"Backend\": { \r\n\t\t\"Type\": \"host-gw\"\n\t}\n}" + } +}'" +EOF + } + } \ No newline at end of file