How to collect all the igress and egress traffic of k8s cluster pods?

1/6/2020

I have k8s cluster with three nodes (Node A, Node B, Node C) and deployed simple nginx with replica 4 and exposed through k8s service.

Now All my nginx are up with thier own pod IP as well as service IP.

Now I need all the igress and egress traffic of my nginx pods to monitor.

I am planning to create a another pod with simple tcpdump utility to log the network traffic but how can i redirect all the other pods traffic into the pod where tcpdump is running.

Thanks in advance for suggestions.

-- Praveenkumar
kubernetes
networking

1 Answer

1/6/2020

I would suggest using a service mesh such as Linkerd or Istio for monitoring network traffic.

A service mesh deploys a proxy as a sidecar along with your pod and since all network traffic goes through this proxy it can capture metrics and store those metrics in Prometheus and then Grafana can be used as a dashboard.

-- Arghya Sadhu
Source: StackOverflow