Ali Rezvani
Ali Rezvani

Reputation: 385

Monitor External traffic of pod or service

I want to monitor external transmit and receive traffics of pod. External traffic means traffic that send or receive from outside of k8s cluster.

For example NodePort, LoadBalancer and ingress types of service. I have container_network_receive_bytes_total and container_network_transmit_bytes_total in Prometheus metrics but I can't seprate internal and external traffic with them. I also used k8spacket but It did not satisfy my need.

What should I do?

Upvotes: 0

Views: 2237

Answers (1)

glv
glv

Reputation: 1167

I think the only way to get the information you need is to install tcpdump in your Pod and exploit its potential.

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.

I don't know which provider you have installed Kubernetes on, but there are very vertical documentations on the subject -->

OpenShift: https://access.redhat.com/solutions/4569211

Azure: https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/packet-capture-pod-level

https://www.redhat.com/sysadmin/capture-packets-kubernetes-ksniff

Upvotes: 1

Related Questions