简体   繁体   English

Kubernetes更改Pod地址

[英]Kubernetes Change Pod-Adresses

I want to change the Kubernetes Pod Ips, because we have in our company a subnet which runs on the same subnet as kubernetes. 我想更改Kubernetes Pod Ips,因为我们公司中有一个子网,该子网与kubernetes运行在同一子网中。

I created a kubernetes-config file with this content (just a snipped): 我用以下内容创建了一个kubernetes-config文件(只是一个片段):

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. 然后,使用额外的参数IPALLOC_RANGE 192.150.0.0/19启动Weave Net。

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. Pod在此池中具有正确的ip地址,但是我无法从群集中相互连接到Pod,而不是不在群集外部。 So we have servers outside of the kubernetes cluster which I also cant connect to. 所以我们在kubernetes集群之外也有服务器,但我也无法连接。

What is your goal? 你的目标是什么? To reconfigure current cluster with existing pods or re-create cluster with different overlay network? 要使用现有的Pod重新配置当前群集,还是使用其他覆盖网络重新创建群集?

I see subnet mess in your ClusterConfiguration : Pay attention that podSubnet and serviceSubnet should not be the same. 我在您的ClusterConfiguration看到子网混乱:请注意podSubnetserviceSubnet不应相同。 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. 还要检查@Janos在kubernetes中提供的答案, 将service cidr和pod cidr设置为同一主题。

You shouldn't mix service IPs with Pod IPs. 您不应将服务IP与Pod IP混合使用。 Service IPs are virtual and used internally by kubernetes for discovering your (services) pods. 服务IP是虚拟的,并且由kubernetes在内部用于发现您的(服务)容器。

If I configure the serviceSubnet and the weave network subnet the same 如果我将serviceSubnet和weave网络子网配置为相同

You shouldn't configure them the same! 您不应该对它们进行相同的配置! Weave subnet is essentially the pod CIDRs 编织子网本质上是Pod CIDR

Pod to Pod communication should be done over k8s services. Pod到Pod的通信应通过k8s服务进行。 Container to container within pods should be done through localhost. Pod中的容器到容器应该通过localhost完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM