From a06c33c3c247eeeac2b75ef24e9f689ef0f866a2 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Thu, 28 Feb 2019 17:32:50 +0100 Subject: [PATCH] calico: Align IPv4 pool CIDR with k8s_master When a non-default pod-network-cidr is used for `kubeadm init`, the same CIDR should be used by Calico in CALICO_IPV4POOL_CIDR. Otherwise we will run into issues like those described in [1]. [1] https://github.com/projectcalico/calico/issues/683 Change-Id: Ifc5cd2847f12e85b23716d4b279fd635988132ef Signed-off-by: Alexandru Avadanii --- scripts/setup-cni.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/setup-cni.sh b/scripts/setup-cni.sh index 8b9730c..643f157 100755 --- a/scripts/setup-cni.sh +++ b/scripts/setup-cni.sh @@ -3,6 +3,7 @@ set -o xtrace set -e CLUSTER_IP=${1:-172.16.1.136} # Align with the value in our K8s setup script +POD_NETWORK_CIDR=${2:-192.168.0.0/16} # Install the Etcd Database if [ "$(uname -m)" == 'aarch64' ]; then @@ -20,7 +21,8 @@ kubectl apply -f "${SCRIPTS_DIR}/cni/calico/${ETCD_YAML}" kubectl apply -f "${SCRIPTS_DIR}/cni/calico/rbac.yaml" # Install Calico to system -sed -i "s/10.96.232.136/${CLUSTER_IP}/" "${SCRIPTS_DIR}/cni/calico/calico.yaml" +sed -i "s@10.96.232.136@${CLUSTER_IP}@; s@192.168.0.0/16@${POD_NETWORK_CIDR}@" \ + "${SCRIPTS_DIR}/cni/calico/calico.yaml" kubectl apply -f "${SCRIPTS_DIR}/cni/calico/calico.yaml" # Remove the taints on master node -- 2.16.6