In kubernetes POD will have IP address and Node will have IP address

10/25/2018

In kubernetes POD will have IP address and Node will have IP address.

I know we use POD IP address for accessing the containers in it with containers port. Do we use Node IP for any purpose? Also Will kubernetes takes care of creating IP address for pods.

-- Vinay
kubectl
kubernetes

1 Answer

10/25/2018

Kubernetes networking plugin creates a separate pod network ( calico, flannel , waeve etc)

Pods are assigned IPs from that pod network

All the containers in a pod have the same IP address since the network namespace is shared

NodeIP can be used to access the service running on the pod , from external systems , such as in case , you expose the service using kubernetes Service of type Nodeport , or expose the service using ingress resource

More:

Every Pod is allocated an IP address, and the CNI plug-in is responsible for its allocation and assignment to a Pod. You may be asking yourself, “If a Pod can have multiple containers, how does the CNI know which one to connect?” If you have ever interrogated Docker to list the containers running on a given Kubernetes node, you may have noticed a number of pause con‐ tainers associated with each of your Pods. These pause containers do nothing meaningful computationally. They merely serve as pla‐ ceholders for each Pod’s container network. As such, they are the first container to be launched and the last to die in the life cycle of an individual Pod

-- Ijaz Ahmad Khan
Source: StackOverflow