Does Kubernetes need to assign real IP addresses?

11/8/2019

I am trying to understand Kubernetes and how it works under the hood. As I understand it each pod gets its own IP address. What I am not sure about is what kind of IP address that is.

Is it something that the network admins at my company need to pass out? Or is an internal kind of IP address that is not addressable on the full network?

I have read about network overlays (like Project Calico) and I assume they play a role in this, but I can't seem to find a page that explains the connection. (I think my question is too remedial for the internet.)

Is the IP address of a Pod a full IP address on my network (just like a Virtual Machine would have)?

-- Vaccano
ip-address
kubernetes

2 Answers

11/8/2019

Kubernetes clusters

Is the IP address of a Pod a full IP address on my network (just like a Virtual Machine would have)?

The thing with Kubernetes is that it is not a service like e.g. a Virtual Machine, but a cluster that has it's own networking functionality and management, including IP address allocation and network routing.

Your nodes may be virtual or physical machines, but they are registered in the NodeController, e.g. for health check and most commonly for IP address management.

The node controller is a Kubernetes master component which manages various aspects of nodes.

The node controller has multiple roles in a node’s life. The first is assigning a CIDR block to the node when it is registered (if CIDR assignment is turned on).

Cluster Architecture - Nodes

IP address management

Kubernetes Networking depends on the Container Network Interface (CNI) plugin your cluster is using.

A CNI plugin is responsible for ... It should then assign the IP to the interface and setup the routes consistent with the IP Address Management section by invoking appropriate IPAM plugin.

It is common that each node is assigned an CIDR range of IP-addresses that the nodes then assign to pods that is scheduled on the node.

GKE network overview describes it well on how it work on GKE.

Each node has an IP address assigned from the cluster's Virtual Private Cloud (VPC) network.

Each node has a pool of IP addresses that GKE assigns Pods running on that node (a /24 CIDR block by default).

Each Pod has a single IP address assigned from the Pod CIDR range of its node. This IP address is shared by all containers running within the Pod, and connects them to other Pods running in the cluster.

Each Service has an IP address, called the ClusterIP, assigned from the cluster's VPC network.

-- Jonas
Source: StackOverflow

11/8/2019

Kubernetes Pods are going to receive a real IP address like how's happening with Docker ones due to the brdige network interface: the real hard stuff to understand is basically the Pod to Pod connection between different nodes and that's a black magic performed via kube-proxy with the help of iptables/nftables/IPVS (according to which component you're running in the node).

A different story regarding IP addresses assigned to a Service of ClusterIP kind: in fact, it's a Virtual IP used to transparently redirect to endpoints as needed.

Kubernetes networking could look difficult to understand but we're lucky because Tim Hockin provided a really good talk named Life of a Packet that will provide you a clear overview of how it works.

-- prometherion
Source: StackOverflow