<p>I want to monitor external transmit and receive traffics of pod. External traffic means traffic that send or receive from outside of k8s cluster.</p>
<p>For example NodePort, LoadBalancer and ingress types of service.
I have <code>container_network_receive_bytes_total</code> and <code>container_network_transmit_bytes_total</code> in Prometheus metrics but I can't seprate internal and external traffic with them. I also used <a href="https://github.com/k8spacket/k8spacket" rel="nofollow noreferrer">k8spacket</a> but It did not satisfy my need.</p>
<p>What should I do?</p>

Ali Rezvani
<p>I think the only way to get the information you need is to install tcpdump in your Pod and exploit its potential.</p>
<p>If you don't want to dirty your application, you can think of creating a management Deployment where you install the tools you need to manage this type of request and connect to that.</p>
<p>I don't know which provider you have installed Kubernetes on, but there are very vertical documentations on the subject --&gt;</p>
<p>OpenShift: <a href="https://access.redhat.com/solutions/4569211" rel="nofollow noreferrer">https://access.redhat.com/solutions/4569211</a></p>
<p>Azure: <a href="https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/packet-capture-pod-level" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/packet-capture-pod-level</a></p>
<p><a href="https://www.redhat.com/sysadmin/capture-packets-kubernetes-ksniff" rel="nofollow noreferrer">https://www.redhat.com/sysadmin/capture-packets-kubernetes-ksniff</a></p>
