Always it's the RAM of the host. So, in this case, it will be every node of the K8 cluster they agent will be deployed to. Used memory of the containers does not matter in this case.
In general there are two oportunities. If you have kuberenetes enviornment build on one or more nodes into single cluster you have to add ram of all worker nodes. This will be your license sizing if you consider full stack monitoring.
You can also use application only monitoring. In such case agent is connected not via operator but it's pushed into pod on runtime during start. In such case each pod is visible in dynatrace as separate small host. In such case license will be calculated based on all pods memory size.