I am able to fetch CPU and memory usage of a pod in a Kubernetes cluster with client-go using the following piece of code.
podContainers := podMetric.Containers
for _, container := range podContainers {
cpu += container.Usage.Cpu().MilliValue()
mem += container.Usage.Memory().ScaledValue(6)
}
But having trouble getting ephemeral storage usage.
container.Usage.StorageEphemeral() //Gives me 0 every time.
How do I get the storage usage?
Even kubectl top pod
command does not give the storage usage. Is there a limitation to provide storage usage from the Kubernetes side?