...

/

Adjusting Resources Based on Actual Usage

Adjusting Resources Based on Actual Usage

Learn about actual resource usage of running containers and adjusting allocation based on need.

Getting the actual resource usage

We saw some of the effects that can be caused by a discrepancy between resource usage and resource specification. It’s only natural that we should adjust our specification to reflect the actual memory and CPU usage better.

The DB container

Let’s start with the database.

Press + to interact
kubectl top pods

The output is as follows:

Press + to interact
NAME CPU(cores) MEMORY(bytes)
go-demo-2-api-... 0m 4Mi
go-demo-2-api-... 0m 4Mi
go-demo-2-api-... 0m 4Mi
go-demo-2-db-... 4m 34Mi

As expected, an api container uses even fewer resources than MongoDB. Its memory is somewhere between 2Mi and 6Mi. Its CPU usage is so low that Metrics Server rounded it to 0m.

The memory usage resources may differ from the above-mentioned limits. ...