robusta-dev / krr

Prometheus-based Kubernetes Resource Recommendations
MIT License
2.98k stars 155 forks source link

Victoria Metrics single detected but isn't used #205

Open fenio opened 8 months ago

fenio commented 8 months ago

Describe the bug Seems that krr detects that cluster uses Victoria Metrics single but still without specifying endpoint it can't find metrics.

To Reproduce Run krr --simple with cluster running VM single:

[☸ lab:network] [⏱ 13s]
❯ ~ krr simple

 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\

Running Robusta's KRR (Kubernetes Resource Recommender) v1.6.0
Using strategy: Simple
Using formatter: table

[INFO] Using clusters: ['lab']
on 0: [INFO] Listing scannable objects in lab
on 0: [INFO] Connecting to Prometheus for lab cluster
on 0: [INFO] Connecting to Victoria for lab cluster
on 0: [INFO] Using Victoria at https://10.10.20.99:6443/api/v1/namespaces/monitor/services/vmsingle-vm:8429/proxy for cluster lab
on 0: [INFO] Connecting to Thanos for lab cluster
on 0: [ERROR] No Prometheus or metrics service found

Expected behavior I'd expect it to fetch metrics and work fine.

Desktop (please complete the following information):

In short despite krr detecting that cluster is running vm single I still have to enable port forward and run it with ❯ ~ krr simple -p http://127.0.0.1:8429 to get actual recommendations.

Not sure why it tries to fetch Prometheus data through proxy. I guess once it detects that there's VM instance in cluster it should establish connection to vmsingle inside that cluster.

fenio commented 8 months ago
[☸ lab:network]
❯ ~ krr simple -p http://127.0.0.1:8429

 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\

Running Robusta's KRR (Kubernetes Resource Recommender) v1.6.0
Using strategy: Simple
Using formatter: table

[INFO] Using clusters: ['lab']
on 0: [INFO] Listing scannable objects in lab
on 0: [INFO] Connecting to Prometheus for lab cluster
on 0: [INFO] Using Prometheus at http://127.0.0.1:8429 for cluster lab
on 0: [INFO] Prometheus found
on 0: [INFO] Prometheus connected successfully for lab cluster
mleklund commented 8 months ago

I believe this might be the same issue I mentioned here:

https://github.com/robusta-dev/prometrix/issues/6