<p>There are already tools out there which visualize the traffic between pods. In detail the state the following:</p>

<ul>
<li><p><a href="https://linkerd.io/2/reference/cli/tap/" rel="nofollow noreferrer">Linkerd tap</a> listens to a traffic stream for a resource.</p></li>
<li><p>In <a href="https://github.com/weaveworks/scope" rel="nofollow noreferrer">Weave Scope</a>, edges indicate <strong>TCP connections</strong> between nodes. </p></li>
</ul>

<p><a href="https://i.stack.imgur.com/2RZZg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2RZZg.png" alt="Linkerd tap"></a></p>

<p>I am now wondering how these tools get the data because the Kubernetes API itself does not provide this information. I know that Linkered installs a proxy next to each service but is this the only option?</p>

<p>The component that monitors the traffic must be either a sidecar container in each pod or a daemon on each node. For example:</p>

<ul>
<li>Linkerd uses a sidecar container</li>
<li>Weave Scope uses a DaemonSet to install an agent on each node of the cluster</li>
</ul>

<p>A sidecar container observes traffic to/from its pod. A node daemon observes traffic to/from all the pods on the node.</p>

<p>In Kubernetes, each pod has its own unique IP address, so these components basically check the source and destination IP addresses of the network traffic.</p>

<p>In general, any traffic from/to/between pods has nothing to do with the Kubernetes API and to monitor it, basically the same principles as in non-Kubernetes environments apply.</p>
