Kubernetes Change Pod-Adresses

3/11/2019

I want to change the Kubernetes Pod Ips, because we have in our company a subnet which runs on the same subnet as kubernetes.

I created a kubernetes-config file with this content (just a snipped):

kind: ClusterConfiguration
kubernetesVersion: v1.13.4
networking:
  dnsDomain: cluster.local
  podSubnet: "192.150.0.0/19"
  serviceSubnet: 192.150.0.0/19
scheduler: {}

Then I start the Weave Net with the extra argument IPALLOC_RANGE 192.150.0.0/19.

The Pods have the right ip-addresses within this pool, but I cant connet to the pods from in the cluster to each other and not outside the cluster. So we have servers outside of the kubernetes cluster which I also cant connect to.

-- Theroth
kubernetes
networking

2 Answers

4/15/2019

You shouldn't mix service IPs with Pod IPs. Service IPs are virtual and used internally by kubernetes for discovering your (services) pods.

If I configure the serviceSubnet and the weave network subnet the same

You shouldn't configure them the same! Weave subnet is essentially the pod CIDRs

Pod to Pod communication should be done over k8s services. Container to container within pods should be done through localhost.

-- Bobby Donchev
Source: StackOverflow

3/12/2019

What is your goal? To reconfigure current cluster with existing pods or re-create cluster with different overlay network?

I see subnet mess in your ClusterConfiguration: Pay attention that podSubnet and serviceSubnet should not be the same. You have to use different ranges.

For example:

kind: ClusterConfiguration
kubernetesVersion: v1.13.4
networking:
  serviceSubnet: "10.96.0.0/12"
  podSubnet: "10.100.0.1/24"
  dnsDomain: "cluster.local
controlPlaneEndpoint: "10.100.0.1:6443"
...

Also check answer provided by @Janos in kubernetes set service cidr and pod cidr the same topic.

-- VKR
Source: StackOverflow