Search code examples
amazon-web-servicesamazon-eksnat

How to find DataTransferred from NAT gateway by each AWS EKS pod?


I have deployed my EKS cluster in private subnetes, Now this subnets have internet access using NAT gateway. I wanted to find out how much data transfered from Each pod to NAT gateway ??


Solution

  • You don't, really.

    There is no available metric available at that level of granularity. You can see the total bytes transferred in/out for each NAT gateway, but it won't tell you what percentage each pod (or any other services in the private subnet for that matter) are accounted for of the total bytes transferred.


    By default, containers from all pods in an EKS cluster share network interface(s) from the host(s) of the cluster, which is more cost effective and saves available IP addresses in your VPC, but means you can't track individual container traffic with flow logs. In theory, (I don't recommend this) you could configure your cluster to assign a VPC network interface for each container in your cluster and track traffic to your NAT gateway(s) independently with VPC flow logs then filter/aggregate the data, relate it back to the origin pods in order to determine how much traffic each pod sent to the NAT gateway. In practice, this is difficult and expensive.

    See How can I find the top talkers or contributors to traffic through the NAT gateway in my VPC? for more detail.

    Another option may be to use a proxy container for requests bound for the NAT gateway and have the proxy collect the metrics per pod. You'd have to configure the pods to use the proxy, share pod information to the proxy, and configure the proxy to track/provide the metrics. I don't know of any off-the-shelf tools that do this.