https://rancher.com/ logo
#rancher-desktop
Title
# rancher-desktop
s

straight-vr-2696

03/07/2023, 3:22 PM
Hi everyone, I have another problem with rancher desktop. I am using a custom kubeconfig to reach a remote cluster, which i put in the .kube folder, in order to not have to write --kubeconfig for my kubectl commands. I have noticed that this does seem to break the local rancher desktop dashboard. Is there an issue with this? Am I doing something wrong? I thought putting another kubeconfig in there shouldn't break stuff, because rancher desktop seems to natively support switching contexts
r

rapid-eye-50641

03/07/2023, 5:32 PM
Rancher Desktop at present doesn't support connecting to remote clusters. At present, the project's main focus is to provide a solution for local Kubernetes & Container management, and related functionality for local development. I do not see us prioritizing remote clusters support in the short term.. However, there's a Github feature request for this... Please provide a like on the issue thread to help us gauge the interest on the request and with the prioritization.
s

straight-vr-2696

03/08/2023, 7:47 AM
I would say my need is a bit different. We use Rancher to manage our remote clusters, but we wanted to give our developers a tool to have docker. kubernetes and helm on their local environment. We chose Rancher Desktop to do this, so we can benefit from an all in one solution that does all the background work to make these three tools work. Now, of course, since we have Rancher desktop, we would like to use it fully, by also using the dashboard for the local kubernetes environment. Here comes the difference between my question and the issue you pointed me at: I do not want to have Rancher desktop show me our remote environment on the dashboard. I want to use the dashboard to see my local kubernetes environment and the problem is that if I add another kubeconfig file (so I can just kubectl to my remote cluster) in the .kube, it breaks the dashboard completely. I can't see the local environment, the dashboard just breaks. I think I have found a workaround, which maybe is the right way to do things, but i would like a confirmation. Rather than adding a new kubeconfig in the .kube, I modified the config file in the .kube (the one created by rancher desktop) by adding my new clusters, users, and context. By doing this, the dashboard works as intended for the local k8s environment and i can also kubectl to my remote clusters. Does this workaround make sense or is there the risk of breaking the local installation? Anyway, about the issue you linked me, I liked it anyway because for those who do not use a solution like rancher to manage their remote clusters, it could be an amazing and powerful way to interact with them
j

jolly-forest-99711

03/08/2023, 6:18 PM
Can you clarify what you mean by "add another kubeconfig file in the .kube"? As far as I know,
kubectl
merges multiple kubeconfig files into one config when it runs. Did you replace the old one? While I'm not too familiar with this part of Rancher Desktop, I can see that causing problems. Have you tried setting the
KUBECONFIG
environment variable to multiple files (by separating the paths with a
:
)? That is something that should work - if it doesn't it may be a bug
s

straight-vr-2696

03/09/2023, 7:27 AM
So, from what I understand, when you start Rancher desktop for the first time after install, you get a .kube folder. In this folder there are another folder called cache and a file named config. This config file contains what I assume is the kubeconfig file for the local cluster that Rancher Desktop create. Now, I downloaded the kubeconfig file from my remote cluster and put it in this .kube folder, without deleting the config file that is already there. This seems to break the rancher desktop dashboard. Instead, if I just copy the configuration of my remote cluster inside the config file that's already there, everything works like a charm. What you said about the environment variable made something come to mind though. The remote kubeconfig file is copied into the .kube folder via a script, which also sets the
KUBECONFIG
env variable to point to that specific kubeconfig. Is it possible that Rancher Desktop looks at this environment variable when trying to open the dashboard? I think this still wouldn't explain why, if I delete my remote kubeconfig or put the config inside the config file, everything starts to work again
To rectify, since I can't seem to edit again my previous message, I verified and the
KUBECONFIG
env variable is actually set to point both to the config and my custom kubeconfig, but they are separated by
;
(I'm on Windows 11). I assume that this is correct though, because i was able to use
kubectl config use-context
and switch between the two contexts with no problem
j

jolly-forest-99711

03/09/2023, 4:53 PM
How does the script set the
KUBECONFIG
environment variable? Does it modify it globally? If so, I could see it causing problems for dashboard...
Honestly, I'm puzzled as to why this is happening. I confirmed with another member of the team that dashboard specifically uses the
rancher-desktop
kubeconfig context, so the problem can't be due to dashboard using the wrong context. Assuming
KUBECONFIG
is set globally, the dashboard should still be finding the old
rancher-desktop
context...
Could you please create an issue for this? Please include clear instructions on how to reproduce it - we won't be able to help otherwise
s

straight-vr-2696

03/10/2023, 7:55 AM
Yes, the
KUBECONFIG
variable is set globally. I will open an issue with the steps that brought me there. I also have forgot to mention that, loooking at the dashboard logs, I see
Copy code
Proxy Error: Error: connect ECONNREFUSED 127.0.0.1:9443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {
  errno: -4078,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 9443
}
2023-03-10T07:51:49.604Z: [HPM] Error occurred while proxying request 127.0.0.1:6120/api/v1/namespaces/cattle-ui-plugin-system/services/<http:ui-plugin-operator:80/proxy/index.json> to <https://127.0.0.1:9443/> [ECONNREFUSED] (<https://nodejs.org/api/errors.html#errors_common_system_errors>)
I am behind a corporate proxy, so I don't know if it can affect the dashboard in any way (but i guess it shouldn't because it should be working with local stuff, right?). Thank you for the help, I'll open an issue and be as detailed as possible
j

jolly-forest-99711

03/10/2023, 5:02 PM
Thanks for doing that. We can continue this conversation there, so there is a permanent record 🙂
83 Views