Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get recommendations by using krr 1.3.2 #108

Closed
agabrys opened this issue Jul 14, 2023 · 3 comments
Closed

Cannot get recommendations by using krr 1.3.2 #108

agabrys opened this issue Jul 14, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@agabrys
Copy link

agabrys commented Jul 14, 2023

Describe the bug

I updated the krr tool from version 1.2.1 to 1.3.2 today. Unfortunately, I cannot find a way to get recommendations by using the simple strategy. The same commands work fine for 1.2.1.

To Reproduce

Execute the following command:

krr.exe simple --kubeconfig <path-to-kubeconfig> --context <context-name> --namespace <namespace-name>

1.2.1

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



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

[WARNING] Could not load context from kubeconfig.
[WARNING] Falling back to clusters from CLI: ['context-name']
[INFO] Using clusters: ['context-name']
[INFO] Listing scannable objects in context-name
[INFO] Found 7 objects across 1 namespaces in context-name
on 0: [INFO] Connecting to Prometheus for context-name cluster
on 0: [INFO] Using Prometheus at https://some-domain-here/api/v1/namespaces/some-namespace-here/services/prometheus-server-service:9091/proxy for cluster context-name
on 0: [INFO] Prometheus found
on 0: [INFO] Prometheus connected successfully for context-name cluster
Calculating Recommendation |████████████████████████████████████████| 7/7 [100%] in 7.1s (0.60/s)



Simple Strategy

CPU request: 99.0% percentile, limit: unset
Memory request: max + 5.0%, limit: max + 5.0%
Learn more: https://github.com/robusta-dev/krr#algorithm
<the table is here>

1.3.2

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



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

[WARNING] Could not load context from kubeconfig.
[WARNING] Falling back to clusters from CLI: ['context-name']
[INFO] Using clusters: ['context-name']
[INFO] Listing scannable objects in context-name
[INFO] Found 7 objects across 1 namespaces in context-name
on 0: [INFO] Connecting to Prometheus for context-name cluster
on 0: [INFO] Using Prometheus at https://some-domain-here/api/v1/namespaces/some-namespace-here/services/prometheus-server-service:9091/proxy for cluster context-name
on 0: [INFO] Prometheus found
Calculating Recommendation |⚠︎                                       | (!) 0/7 [0%] in 3.9s (0.00/s)
[ERROR] No label specified, Rerun krr with the flag `-l <cluster>` where <cluster> is one of [<a very long list of items>]

The a very long list of items contains all K8s namespaces. As requested I added the -l parameter with the namespace-name value (that value was in the list):

krr.exe simple --kubeconfig <path-to-kubeconfig> --context <context-name> --namespace <namespace-name> -l <namespace-name>
 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\



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

[WARNING] Could not load context from kubeconfig.
[WARNING] Falling back to clusters from CLI: ['context-name']
[INFO] Using clusters: ['context-name']
[INFO] Listing scannable objects in context-name
[INFO] Found 7 objects across 1 namespaces in context-name
on 0: [INFO] Connecting to Prometheus for context-name cluster
on 0: [INFO] Using Prometheus at https://some-domain-here/api/v1/namespaces/some-namespace-here/services/prometheus-server-service:9091/proxy for cluster context-name
on 0: [INFO] Prometheus found
on 0: [WARNING] Prometheus returned no MemoryMetricLoader metrics for StatefulSet namespace-name/statefulset-name-1/container-name-1
on 0: [WARNING] Prometheus returned no CPUMetricLoader metrics for StatefulSet namespace-name/statefulset-name-1/container-name-1
on 1: [WARNING] Prometheus returned no CPUMetricLoader metrics for StatefulSet namespace-name/statefulset-name-2/container-name-2
on 1: [WARNING] Prometheus returned no MemoryMetricLoader metrics for StatefulSet namespace-name/statefulset-name-2/container-name-2
[...]

Simple Strategy

CPU request: 99.0% percentile, limit: unset
Memory request: max + 5.0%, limit: max + 5.0%

This strategy does not work with objects with HPA defined (Horizontal Pod Autoscaler).
If HPA is defined for CPU or Memory, the strategy will return "?" for that resource.

Learn more: https://github.com/robusta-dev/krr#algorithm

┏━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Number ┃ Namespace      ┃ Name                           ┃ Pods ┃ Old Pods ┃ Type        ┃ Container              ┃ CPU Diff ┃ CPU Requests         ┃ CPU Limits           ┃ Memory Diff ┃ Memory Requests       ┃ Memory Limits         ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
│     1. │ namespace-name │ deployment-name-1              │ 2    │ 0        │ Deployment  │ container-name-1       │          │ 500m -> ? (No data)  │ 1 -> ? (No data)     │             │ 1600Mi -> ? (No data) │ 1920Mi -> ? (No data) │
├────────┼────────────────┼────────────────────────────────┼──────┼──────────┼─────────────┼────────────────────────┼──────────┼──────────────────────┼──────────────────────┼─────────────┼───────────────────────┼───────────────────────┤
[...]

<all recommendations are set to no data>

My kubeconfig:

apiVersion: v1
kind: Config
clusters:
  - name: context-name
    cluster:
        server: 'https://some-domain-here'
        certificate-authority-data: >-
            some-data-here
contexts:
  - name: context-name
    context:
        cluster: context-name
        user: context-name-token
        namespace: default
current-context: context-name
users:
  - name: context-name-token
    user:
        exec:
            apiVersion: client.authentication.k8s.io/v1beta1
            command: kubectl
            args:
              - oidc-login
              - get-token
              - some-params-here

Expected behavior

Recommendations should be provided with valid data.

Desktop:

  • OS: Microsoft Windows 11 Enterprise, 10.0.22621 N/A Build 22621
  • PowerShell 7.3.6
  • Browser: Brave 1.52.130 with Chromium 114.0.5735.198 (Official Build)
@cr7258
Copy link
Contributor

cr7258 commented Jul 15, 2023

I have created a PR to fix this issue: #101

@LeaveMyYard LeaveMyYard added the bug Something isn't working label Jul 18, 2023
@Avi-Robusta
Copy link
Contributor

Hi,
It looks like the issue @cr7258 fixed.
I just merged it to master. Can you try running krr from master to see if the issue still happens?

@agabrys
Copy link
Author

agabrys commented Jul 18, 2023

I tested version v1.4.0 and it works 👍

@agabrys agabrys closed this as completed Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants