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

kubecost cost cli predict fails on 2.2.x #172

Open
2 tasks done
dazmc opened this issue Jun 5, 2024 · 2 comments
Open
2 tasks done

kubecost cost cli predict fails on 2.2.x #172

dazmc opened this issue Jun 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@dazmc
Copy link

dazmc commented Jun 5, 2024

Kubecost Version

2.2.5

Kubernetes Version

1.28

Kubernetes Platform

EKS

Description

kubectl plugin for kubecost (aka cost) errors when executing predict subcommand.

EKS 1.28.8
kubecost UI Version 2.2.5 (c0726bff)
kubectl cost version info
Git Commit: d675760
Git Branch: HEAD
Git State: clean
Git Summary: v0.6.2
Build Date: 2024-03-19T16:32:10Z

if i use the yaml example here

read -r -d '' DEF << EndOfMessage
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: default
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        resources:
          requests:
            cpu: "3"
            memory: "2Gi"
EndOfMessage
echo "$DEF" | kubectl cost predict -f -

Error: Failed querying the speccost API. This API requires a version of Kubecost >= 1.101, which may be why this query failed. If running Kubecost v1.100, you can downgrade kubectl cost to v0.4 for old-style prediction. Error: failed to port forward query: received non-200 status code 502 and data: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.25.5</center>
</body>
</html>

Steps to reproduce

  1. Deploy kubecost version 2.2.5
  2. Install cost plugin - kubectl krew install cost
  3. Use predict subcommand
read -r -d '' DEF << EndOfMessage
 apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: nginx-deployment
   namespace: default
   labels:
     app: nginx
 spec:
   replicas: 3
   selector:
     matchLabels:
       app: nginx
   template:
     metadata:
       labels:
         app: nginx
     spec:
       containers:
       - name: nginx
         image: nginx:1.14.2
         resources:
           requests:
             cpu: "3"
             memory: "2Gi"
 EndOfMessage
 echo "$DEF" | kubectl cost predict -f -

Expected behavior

It should work

 OBJECT                      Δ QTY  RESOURCE UNIT  COST PER UNIT    Δ COST/MO  % CHANGE 
────────────────────────────────────────────────────────────────────────────────────────
 default deployment             +9  CPU cores          23.27 USD  +209.47 USD           
 nginx-deployment                                                                       
                                +6  RAM GiB             3.12 USD   +18.72 USD           
                                                                                        
────────────────────────────────────────────────────────────────────────────────────────
 TOTAL MONTHLY COST CHANGE                                        +228.18 USD           

But it doesn't

Error: Failed querying the speccost API. This API requires a version of Kubecost >= 1.101, which may be why this query failed. If running Kubecost v1.100, you can downgrade kubectl cost to v0.4 for old-style prediction. Error: failed to port forward query: received non-200 status code 502 and data: <html>
 <head><title>502 Bad Gateway</title></head>
 <body>
 <center><h1>502 Bad Gateway</h1></center>
 <hr><center>nginx/1.25.5</center>
 </body>
 </html>

Impact

We want to use kubectl cost predict subcommand as part of CI/CD process this hinders end to end benefit of kubecost. Monitoring and adjusting what has already been deployed works, but blocking it being created in the first place fails.

Using version 1.x is not a valid approach

Screenshots

No response

Logs

No response

Slack discussion

https://kubecost.slack.com/archives/CE76NJE6S/p1717166927611369?thread_ts=1717166927.611369&cid=CE76NJE6S

Troubleshooting

  • I have read and followed the issue guidelines and this is a bug impacting only the Kubecost application.
  • I have searched other issues in this repository and mine is not recorded.
@dazmc dazmc added bug Something isn't working needs-triage labels Jun 5, 2024
@chipzoller chipzoller transferred this issue from kubecost/features-bugs Jun 12, 2024
@chipzoller
Copy link

cc @AjayTripathy and @teevans. Do we intend to keep this extension up-to-date?

@cliffcolvin
Copy link
Member

@dazmc will include this in my eng ticket with related gh issue. Will get you an update soon.

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

3 participants