The calculation can be derived in three ways, each offering a different monitoring perspective:
All metrics used in these calculations are fetched from 'kubectl' commands
Pod CPU and Memory Consumption
- Command: kubectl top pod --all-namespaces
- Retrieved Metrics:
- Pod CPU Used (millicores): Current CPU consumption by each pod.
- Pod Memory Used (MiB): Current memory consumption by each pod.
- Pod Resource Limits and Node Capacity
- Command: kubectl describe nodes
- Retrieved Metrics:
- Pod CPU Limit (millicores): Maximum CPU each pod can use.
- Pod Memory Limit (MiB): Maximum memory each pod can use.
- Pod CPU Request (millicores): Guaranteed CPU allocation for each pod.
- Pod Memory Request (MiB): Guaranteed memory allocation for each pod.
- Node's Allocatable CPU (millicores): Available CPU capacity on each node.
- Node's Allocatable Memory (MiB): Available memory capacity on each node.
The calculation method can be configured by updating the Global Config key in the AM_GLOBALCONFIG table.
Global Config Key: am.cloud.azure.aks.pod.usage.calculation
- Possible Values:
- podlimits – Pod limit based calculation
- podrequests – Pod request based calculation
- nodeallocatable – Node allocatable based calculation
- Default Behavior: By default, the global config key does not exist. In this case, the Pod CPU and Memory Usage (%) calculation is based on Pod Limits.
- Steps to configure: Open the query tool and perform the below steps.
- Verify Key Existence: Check whether the key 'am.cloud.azure.aks.pod.usage.calculation' exists in the AM_GLOBALCONFIG table.
SELECT * FROM AM_GLOBALCONFIG WHERE NAME = 'am.cloud.azure.aks.pod.usage.calculation';- If the key does not exist, to switch the calculation method perform an INSERT operation.
INSERT INTO AM_GLOBALCONFIG (NAME, VALUE) VALUES ('am.cloud.azure.aks.pod.usage.calculation', 'podrequests');- If the key exists, perform an UPDATE operation to switch the calculation method.
UPDATE AM_GLOBALCONFIG SET VALUE = 'nodeallocatable' WHERE NAME = 'am.cloud.azure.aks.pod.usage.calculation';