Kubernetes — How does service network work in the cluster

Joey Yi Zhao
10 min readFeb 22, 2022

This article is to address how Kubernetes network works with service object in your cluster with some step by step examples. It is mainly to focus on pod, service, node relationship. You need to have some basic knowledge about Kubernetes if you want to dig into this topic.

When working with Kubernetes at beginning, I always confused about how the network works among different nodes, pod, services etc. For many developers with a lot of Kubernetes experience who I have talked with, they don’t quite understand how the network traffic works among different pods, services. As a good engineer, I would strongly recommend that we need to dig into on this topic more to get a better idea about what is happening underneath. Sometimes, a very simple network issue may cause outage for a long time if you can’t spot on the root cause.

Networking basics

To start with some basics, when you deploy a Kubernetes cluster, the network follows some rules among nodes, pods and services:

  • All nodes can talk with each other
    When a cluster has more than one nodes , Kubernetes guarantees that all nodes can communicate with each other via the network provided from the cluster.
  • Every pod gets its own IP
    Each pod deployed on the cluster will have its own IP address.
  • All pods can talk to each other without NAT
    Pods can be deployed to different nodes, Kubernetes guarantees that each pod can talk to each other…

--

--