3

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?

shailesh
  • 75
  • 1
  • 10
  • May be this is of help? https://stackoverflow.com/questions/52763291/get-current-resource-usage-of-a-pod-in-kubernetes-with-go-client – Shibu Mar 15 '21 at 11:21

0 Answers0