Don't set kube-proxy cluster-cidr with aws-vpc-cni

Signed-off-by: Spike Curtis <spike@tigera.io>
This commit is contained in:
Spike Curtis 2018-07-11 14:32:30 -07:00
parent b213de6c25
commit 1540f906d2
1 changed files with 8 additions and 1 deletions

View File

@ -60,7 +60,14 @@ func (b *KubeProxyOptionsBuilder) BuildOptions(o interface{}) error {
// * dns-controller talks to the API using the kube-proxy configured kubernetes service
if config.ClusterCIDR == "" {
if clusterSpec.KubeControllerManager != nil {
// If we're using the AmazonVPC networking, we should omit the ClusterCIDR
// because pod IPs are real, routable IPs in the VPC, and they are not in a specific
// CIDR range that allows us to distinguish them from other IPs. Omitting the ClusterCIDR
// causes kube-proxy never to SNAT when proxying clusterIPs, which is the behavior
// we want for pods.
// If we're not using the AmazonVPC networking, and the KubeControllerMananger has
// a ClusterCIDR, use that because most networking plug ins draw pod IPs from this range.
if clusterSpec.Networking.AmazonVPC == nil && clusterSpec.KubeControllerManager != nil {
config.ClusterCIDR = clusterSpec.KubeControllerManager.ClusterCIDR
}
}