vladimirvivien / ktop

A top-like tool for your Kubernetes clusters
Apache License 2.0
727 stars 15 forks source link

Program shows long log output when server not available #9

Closed vladimirvivien closed 2 years ago

vladimirvivien commented 2 years ago

When the API server is not available, ktop simply output a log message instead of immediately disconnecting

kubectl ktop
Connected to: http://localhost:8080
...
W0108 13:32:42.673131   55437 reflector.go:324] pkg/mod/k8s.io/client-go@v0.23.1/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: Get "http://localhost:8080/apis/apps/v1/replicasets?limit=500&resourceVersion=0": dial tcp [::1]:8080: connect: connection refused
W0108 13:32:42.673162   55437 reflector.go:324] pkg/mod/k8s.io/client-go@v0.23.1/tools/cache/reflector.go:167: failed to list *unstructured.Unstructured: Get "http://localhost:8080/apis/batch/v1/jobs?limit=500&resourceVersion=0": dial tcp [::1]:8080: connect: connection refused
E0108 13:32:42.673484   55437 reflector.go:138] pkg/mod/k8s.io/client-go@v0.23.1/tools/cache/reflector.go:167: Failed to watch *unstructured.Unstructured: failed to list *unstructured.Unstructured: Get "http://localhost:8080/apis/apps/v1/replicasets?limit=500&resourceVersion=0": dial tcp [::1]:8080: connect: connection refused
...

A better approach would be to stop sooner if the api server is not immediately available. Or, manage the UI better as a valid connection is being tried.

Dentrax commented 2 years ago

+1, we can simply error out: E0108 13:32:42.673484 network is unreachable: 10.84.90.84:6443.

Maybe adding some resiliency (retry after x secs) would better in this case.

vladimirvivien commented 2 years ago

This should no longer be the case with v0.3.0. Closing it.