skip to Main Content

I have a newbie Kubernetes setup question that I can’t find the answer to. Maybe community friends can help me.

MY SETUP:

I have a personal R&D Lab created using a robust PC running:

  • Fedora-30 (the outer Host O/S)
  • Multiple LXC O/S containers (as Guests running CentOS-8)
  • And Docker CE nested and running within those LXC guest containers

Using this setup, I’m able to mutate the “personality” of this environment to assume various technology and application development stacks.

Now the outer Host and LXC Guest O/S’ all have static IP-address on the same subnet as any other device on my personal (home) network (basically bridged because it’s just easier). The relevant hosts and IP-addresses for this question, are:

  • Fedora-30 outer Host (the PC): 192.168.0.16/24
  • vps10 (CentOS-8) LXC guest: 192.168.0.180/24k8s00
  • vps11 (CentOS-8) LXC guest: 192.168.0.181/24k8s01
  • vps12 (CentOS-8) LXC guest: 192.168.0.182/24k8s02
  • vps13 (CentOS-8) LXC guest: 192.168.0.183/24k8s03

I would like to setup a small Kubernetes cluster, with k8s00 (above) being it’s master node, and with k8s01, k8s02 and k8s03 (above) being the worker nodes. Again, these are LXC O/S containers with Docker CE nested within them (all working well).

MY QUESTION:

As I set up Kubernetes, I would like to keep these IP-addresses (since other R&D Lab projects depend on them). Yet I can’t tell from the documentation if I can or cannot keep them. In other words, does the below initialization command (example below) imply that I need to wipe out all IP-addresses and let it take over IP-address assignment; or I don’t need to do that because the command simply creates an “overlay network” using the specified CIDR (atop my aforementioned static IP-addresses).

Many documents and books focus on super simple setups or all-in-a-box setups, which don’t apply to my scenario here.

Anyway, I hope it’s the latter (i.e. being able to keep my IP-addresses) because they effectively represent the bare-metal addresses of those LXC “servers”, which I would like to keep.

vps10$ sudo kubeadm init --pod-network-cidr=Some-Network/Some-Mask [other_options]

P.S. Assuming the answer is that I can keep my said static IP-addresses, what CIDR might be recommend for the above command? Same subnet; different subnet, etc.

Sorry for the verbose question. This will literally be my first Kubernetes setup, and things are already complicated, so I appreciate any walk-through answers.

Thanks. I hope this helps others, too.
(◠﹏◠)/

2

Answers


  1. You can keep your k8s cluster nodes static ip addresses.
    While kubeadm init, your specified pod network subnet should not overlap with your cluster nodes subnet. In below command, specified pod subnet is not overlapping with your cluster subnet.

    sudo kubeadm init --pod-network-cidr=10.16.96.0/24 --apiserver-advertise-address=<master-node-ip_addr> 
    

    You can initialize pod subnet of your choice but if it will overlap with you cluster nodes subnet, then it will create a complicated situation. (as these are 2 different subnetworks but if you specify same subnet range then your newly created pod could have a ip address same as one of your cluster node ip address)

    Login or Signup to reply.
  2. You must install a Pod network add-on so that your Pods can communicate with each other.You can install only one Pod network per cluster.refer. So just make sure your pod network addon config range does not overlap with your k8s cluster nodes static ip addresses.

    Example : By default, Calico uses 192.168.0.0/16 as the Pod network CIDR, though this can be configured in the calico.yaml file. So make sure you are using correct range.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search