kubeshop / monokle

Monokle is a set of OSS tools designed to help create and maintain high-quality Kubernetes configurations throughout the application lifecycle
https://monokle.io
MIT License
1.66k stars 126 forks source link

Cannot connect to the cluster: An unknown problem occurred. Consider taking a peek at the debug logs. #4213

Open bala-gif opened 5 months ago

bala-gif commented 5 months ago

I have my k8s cluster up and running in EKS.

When I pass the kubeconfig file to Monokle app. It cannot connect to the cluster.

GilbertGeliba commented 5 months ago

For me, it seems like related to spaces in context name, e.g. cluster-id-John Smith-namespace. This context name is created by a CLI tool that does user authentication in my company. If I manually edit the kubeconfig file and remove the spaces, I can connect to the cluster.

olensmar commented 5 months ago

thanks for adding that detail @GilbertGeliba - very helpful!

bala-gif commented 5 months ago

Nothing helped. I dont see any space issue in my kubeconfig file.. Adding more detailed info in debug logs would help much to narrow down.

[root@ ~]# kubectx eks@eksxxx.us-east-1.eksctl.io eks@xxx-22853.eu-west-1.eksctl.io

[11:02:57 - stderr] Cannot connect to the cluster: An unknown problem occurred. Consider taking a peek at the debug logs.

StefanSa commented 5 months ago

Hi there, the same Bug here. any Help ?

Serverfrog commented 4 months ago

The thing i found (PS: Pressing on View Debug Logs doesn't bring up the debug log location)

[2024-02-28 15:46:25.244] [browser] [info]  [kubectl-proxy]: Append Server Path enabled.
[2024-02-28 15:46:25.300] [browser] [info]  [kubectl-proxy] {
  type: 'stderr',
  content: 'Error: flags cannot be placed before plugin name: --context=k3d-default\n',
  timestamp: 1709131585300
}
[2024-02-28 15:46:25.306] [browser] [info]  [kubectl-proxy] {
  type: 'exit',
  content: 'Exited with code 1',
  code: 1,
  timestamp: 1709131585306
}
[2024-02-28 15:46:25.306] [browser] [error] Cluster error reason: exit_before_resolve
joebowbeer commented 4 months ago

In my case (MacOS connecting to EKS), the debug log just shows a kubectl proxy command

kubectl --context="arn:aws:eks:us-west-2:XXX:cluster/YYY" --kubeconfig="/Users/me/.kube/config" \
  proxy --port=30007 --append-server-path=true

If I run this myself, I see:

error: listen tcp 127.0.0.1:30007: bind: address already in use

If I remove the --port argument, then the proxy runs and seems to be working.

Perhaps this provides a clue?

WitoDelnat commented 4 months ago

Hi folks!

We're having some trouble to reproduce the EKS connectivity problem. We tried with several (new and old) clusters and all of them connect. The authentication works with an ExecConfig using aws eks get-token under the hood (found in the kubeconfig).

As for debug logs, they would only show after the proxy properly started, which does not help if the proxy boot itself fails. @monojack made a patch release last Thursday to improve logging. Unfortunately, that does still not fix the EKS connectivity issue but it might uncover more information as to why it fails on your end.

For those who reached out to us:

Thank you all for taking the time to report this to us.