kubecost / kubectl-cost

CLI for determining the cost of Kubernetes workloads
Apache License 2.0
913 stars 60 forks source link

Only port-forward to Ready Pods #115

Closed michaelmdresser closed 2 years ago

michaelmdresser commented 2 years ago

What does this PR change?

Tested on a cluster with spot nodes, which causes the kubecost-cost-analyzer pod to occasionally die in a Completed state, which cannot serve requests. This change makes kubectl-cost work correctly in that environment.

How does this PR impact users? (This is the kind of thing that goes in release notes!)

How was this PR tested?

Against a cluster with cost-analyzer pods in a Completed state. Before the change, kubectl cost panicked. Afterward, it functions correctly.