@@ -819,9 +819,15 @@ function Configure-CniNetworking {
819
819
Log- Output (" using mgmt IP ${mgmt_ip} and mgmt subnet ${mgmt_subnet} for " +
820
820
" CNI config" )
821
821
822
+ # We reserve .1 and .2 for gateways. Start the CIDR range from ".3" so that
823
+ # IPAM does not allocate those IPs to pods.
824
+ $cidr_range_start = `
825
+ ${env: POD_CIDR}.substring (0 , ${env: POD_CIDR}.lastIndexOf (' .' )) + ' .3'
826
+
822
827
# Explanation of the CNI config values:
823
828
# CLUSTER_CIDR: the cluster CIDR from which pod CIDRs are allocated.
824
829
# POD_CIDR: the pod CIDR assigned to this node.
830
+ # CIDR_RANGE_START: start of the pod CIDR range.
825
831
# MGMT_SUBNET: the subnet on which the Windows pods + kubelet will
826
832
# communicate with the rest of the cluster without NAT (i.e. the subnet
827
833
# that VM internal IPs are allocated from).
@@ -841,7 +847,8 @@ function Configure-CniNetworking {
841
847
},
842
848
"ipam": {
843
849
"type": "host-local",
844
- "subnet": "POD_CIDR"
850
+ "subnet": "POD_CIDR",
851
+ "rangeStart": "CIDR_RANGE_START"
845
852
},
846
853
"dns": {
847
854
"Nameservers": [
@@ -881,6 +888,7 @@ function Configure-CniNetworking {
881
888
}
882
889
]
883
890
}' .replace(' POD_CIDR' , ${env: POD_CIDR} ).`
891
+ replace(' CIDR_RANGE_START' , ${cidr_range_start} ).`
884
892
replace(' DNS_SERVER_IP' , ${kube_env} [' DNS_SERVER_IP' ]).`
885
893
replace(' DNS_DOMAIN' , ${kube_env} [' DNS_DOMAIN' ]).`
886
894
replace(' MGMT_IP' , ${mgmt_ip} ).`
0 commit comments