StatusTypeRelevance

Overview

INFO

Use krr to compare resource consumption of cluster resources with set requests/limits.

Usage

# -> switch to k8s cluster context to inspect
# kubectl config use-context aks-sdk-dev
# kctx
python krr.py simple

Example output

Installation

Prerequisites

-> python3 installed

Setup locally with venv

# Clone the repository
git clone https://github.com/robusta-dev/krr.git
cd krr
 
# Create and activate venv
python3 -m venv venv
source venv/bin/activate
 
# Install Python dependencies
pip install --upgrade pip
pip install -r requirements.txt
 
# (Optional) Verify it works
python3 krr.py --help

🧾 Additional Resources


▶️ https://github.com/robusta-dev/krr#prometheus-victoria-metrics-and-thanos-auto-discovery
https://www.cncf.io/blog/2022/10/20/kubernetes-best-practice-how-to-correctly-set-resource-requests-and-limits/
https://blog.kubecost.com/blog/requests-and-limits/
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes

🎫 Refs

https://jira.efs-techhub.com/browse/EFSAI-5584

util

use values that adhere to power-of-two memory alignment

64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472, 1536, 1600, 1664, 1728, 1792, 1856, 1920, 1984, 2048, 2112, 2176, 2240, 2304, 2368, 2432, 2496, 2560, 2624, 2688, 2752, 2816, 2880, 2944, 3008, 3072, 3136, 3200, 3264, 3328, 3392, 3456, 3520, 3584, 3648, 3712, 3776, 3840, 3904, 3968, 4032, 4096, 4160, 4224, 4288, 4352, 4416, 4480, 4544, 4608, 4672, 4736, 4800, 4864, 4928, 4992, 5056, 5120, 5184, 5248, 5312, 5376, 5440, 5504, 5568, 5632, 5696, 5760, 5824, 5888, 5952, 6016, 6080, 6144, 6208, 6272, 6336, 6400, 6464, 6528, 6592, 6656, 6720, 6784, 6848, 6912, 6976, 7040, 7104, 7168, 7232, 7296, 7360, 7424, 7488, 7552, 7616, 7680, 7744, 7808, 7872, 7936, 8000, 8064, 8128, 8192, 
//generates all numbers starting at (2^6) up to (2^13) in exponentially doubling ranges, filling each range with values spaced by 64 and collecting them in sorted order.
var step = 64
var lower = 1 shl 6
var upper = 1 shl 13
 
val results = sortedSetOf<Int>()
var base = lower
 
while (base < upper) {
    var value = base
    base = base shl 1
 
    while (value < base) {
        results.add(value)
        value += step
    }
 
    results.add(value)
}
 
for (n in results) {
    println(n)
}