How to get pod usage of hardware resource?

Using microk8s 1.18.3, latest/edge, Ubuntu 20.04

Q1. I would like to have an idea about the hardware resources consumed by the pods. In terms of CPU, disk storage, memory. Can you please advise a way to get this information?

Q2. Within a pod, is it possible to have the same kind of info per container?

You could enable the metrics-server [1] (microk8s enable metrics-server) and try to get the resource metrics from there. There is also the Prometheus addon (microk8s enable prometheus) that offers insight on the resources used. Unfortunately I haven’t done any coding on interfacing with those systems so I do not know how hard that would be.

[1] https://github.com/kubernetes-sigs/metrics-server