How to get the traffic between pods in Kubernetes

9/4/2019

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

  • Linkerd tap listens to a traffic stream for a resource.

  • In Weave Scope, edges indicate TCP connections between nodes.

Linkerd tap

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?

-- ammerzon
kubernetes
kubernetes-pod
networking

3 Answers

9/4/2019

You can use SideCar Proxy for it or use prometheus-operator which internally uses grafana dashboards. in there you can monitor each and everything.

-- Madhu Potana
Source: StackOverflow

9/4/2019

My advice is to use istio.io that injects an envoy proxy as a sidecar container on each pod, then you can use Prometheus to scrape metrics from these proxies and use Grafana for visualisation.

-- wolmi
Source: StackOverflow

9/4/2019

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

  • Linkerd uses a sidecar container
  • Weave Scope uses a DaemonSet to install an agent on each node of the cluster

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

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.

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.

-- weibeld
Source: StackOverflow