Score:0

Choosing Public IP or VPC IP for creating Kubernetes cluster

fj flag

I have 3 compute engines (VMs) from a cloud provider, and I can connect to them using my SSH key and their public IP.
I want to run a Kubernetes cluster (1 master, 2 workers) using kubelet on these machines, and the question arises when I want to address the nodes.
Each machine has a VPC IP in 192.168.x.x and a public one in 183.x.x.x; when advertising the master node and joining workers, which IP should I use?

for example, on the master node, I need to advertise the master node IP using this command:

kubeadm init --apiserver-advertise-address=[Master Node IP] --pod-network-cidr=10.15.0.1/16

Considering that these VMs are connected through VPC private IPs, is it recommended to use public IPs for advertising the master node and joining worker nodes?

Mikołaj Głodziak avatar
id flag
Hello, which cloud provider are you using?
fj flag
@MikołajGłodziak Hey, It's not a well-known cloud provider like GCP, AWS, IBM, etc...
Score:0
id flag

You should avoid using public IP addresses wherever you can. A public IP address means anyone can try to connect to your cluster. If you use the VPC, you will be isolated from the rest of the network. That is good and safe solution. You should use public IP addresses only where is absolutely necessary. Inside the cluster you should also use private IPs. If you need to expose your application to the internet, you can use ingress or service mesh architecture like istio.

fj flag
Very grateful for your response, it is the same answer I reached after a lot of trial and error. With the private VPC IP addresses, I created the cluster, and my master node's public IP address was used to connect to it. As well, a HAProxy has been added to the master node and it is working fine with its public IP.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.