Reputation: 532
Managing Resources for Containers.
When you specify a Pod, you can optionally specify how much of each resource a Container needs. The most common resources to specify are CPU and memory (RAM); there are others.
Kubernetes defined a special metrics for CPU and Memory allocation for a Pod. While Memory looks straightforward, CPU is a bit tricky to understand. It's like breaking something whole into pieces.
Is there any best practices to estimate/calculate those kubernetes resources for a Pod?
Upvotes: 7
Views: 1931
Reputation: 1366
The requests and limits for pods depend on how much memory and CPU resources the application is using. These values may vary depending on how the application is being used.
Based on this, the best way to decide what requests and limits need to be set for an application is to observe its behavior during runtime.
Performance tests can help receive appropriate data. To store your metrics you need to have a metrics server and a database. After necessary data collected, you can take the maximum, minimum, average values of the memory and CPU.
Another possible solution is to use the Vertical Pod Autoscaler (VPA):
frees the users from necessity of setting up-to-date resource limits and requests for the containers in their pods. When configured, it will set the requests automatically based on usage and thus allow proper scheduling onto nodes so that appropriate resource amount is available for each pod. It will also maintain ratios between limits and requests that were specified in initial containers configuration.
Or if you prefer tools with graphical interface, you can use Goldilocks:
By using the kubernetes vertical-pod-autoscaler in recommendation mode, we can see a suggestion for resource requests on each of our apps. This tool creates a VPA for each workload in a namespace and then queries them for information.
Once your VPAs are in place, you'll see recommendations appear in the Goldilocks dashboard.
Upvotes: 1
Reputation: 1896
Different ways:
See current usage with: kubectl top pod
Deploy the Kubernetes dashboard to see short-term data
Deploy Prometheus to see also trend usage
Upvotes: 2
Reputation: 2171
You can use prometheus and grafana to monitor and then estimate resources for Pod.
Upvotes: 0