Open heyvoon opened 2 years ago
same issue with me as well. Cannot connect to minikube running on WSL-2 on windows-11-pro
I had two issues, the pathing was messed up in the syntax and the path to the actual client keys was wrong.
I'm running docker on windows 11, starting my minikube from WSL2.
Solution that worked for me:
1) Copy your config from \\wsl.localhost\Ubuntu-22.04\home\${WSL2-HOME}\.kube
, I removed anything that was unrelated to minikube.
2) change paths of certificates to the absolute path from your windows machine, you should have something like the following config as the outcome:
apiVersion: v1
clusters:
- cluster:
certificate-authority: \\wsl.localhost\Ubuntu-22.04\home\${WSL2-HOME}\.minikube\ca.crt
extensions:
- extension:
last-update: Fri, 09 Sep 2022 20:13:40 IDT
provider: minikube.sigs.k8s.io
version: v1.26.1
name: cluster_info
server: https://127.0.0.1:60299
name: minikube
contexts:
- context:
cluster: minikube
extensions:
- extension:
last-update: Fri, 09 Sep 2022 20:13:40 IDT
provider: minikube.sigs.k8s.io
version: v1.26.1
name: context_info
namespace: default
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: docker-desktop
user:
client-certificate-data: (key)
client-key-data: (key)
- name: minikube
user:
client-certificate: \\wsl.localhost\Ubuntu-22.04\home\${WSL2-HOME}\.minikube\profiles\minikube\client.crt
client-key: \\wsl.localhost\Ubuntu-22.04\home\${WSL2-HOME}\.minikube\profiles\minikube\client.key
3) in Lens, menu in top left > file > add cluster, paste and apply
I was also having problem and my cluster was not visible on lens :
Then I found a solution that we have to add our Cluster manually to the LENS DESKTOP by following ways :
1 . in your WSL command line start the minikube cluster .... by minikube start
command
kubectl config view
your config file will be visible .....\\wsl.localhost\Ubuntu-20.04\home\${your username}\.kube\config
ctrl+shift+a
) .....\\wsl.localhost\Ubuntu-{your version}\
before \home
at certificate-authority
, client-certificate
, client-key
Your minikube will be visible on lens desktop
NOTE:-
In my case the problem was with WSL root path.
\\wsl.localhost
simply don't work, I needed to change this to \\wsl$\Ubuntu\
So whole config looks like this:
apiVersion: v1
clusters:
- cluster:
certificate-authority: \\wsl$\Ubuntu\home\${WSL2-HOME}\.minikube\ca.crt
extensions:
- extension:
last-update: Sat, 22 Oct 2022 17:28:11 CEST
provider: minikube.sigs.k8s.io
version: v1.27.1
name: cluster_info
server: https://127.0.0.1:54002
name: minikube
contexts:
- context:
cluster: minikube
extensions:
- extension:
last-update: Sat, 22 Oct 2022 17:28:11 CEST
provider: minikube.sigs.k8s.io
version: v1.27.1
name: context_info
namespace: default
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: \\wsl$\Ubuntu\home\${WSL2-HOME}\.minikube\profiles\minikube\client.crt
client-key: \\wsl$\Ubuntu\home\${WSL2-HOME}\.minikube\profiles\minikube\client.key
I was also having problem and my cluster was not visible on lens : Then I found a solution that we have to add our Cluster manually to the LENS DESKTOP by following ways : 1 . in your WSL command line start the minikube cluster .... by
minikube start
command 2. then runkubectl config view
your config file will be visible ..... 3. if kubectl is not installed then you have to go manually to config path\\wsl.localhost\Ubuntu-20.04\home\${your username}\.kube\config
4. then copy that config file and paste in lens ---> add cluster (ctrl+shift+a
) ..... 5. edit your config file and add\\wsl.localhost\Ubuntu-{your version}\
before\home
atcertificate-authority
,client-certificate
,client-key
6. after edit the config file : 7. add clusterYour minikube will be visible on lens desktop
NOTE:-
MINIKUBE CLUSTER MUST BE STARTED
THANKS! It works for me)
I was also having problem and my cluster was not visible on lens : Then I found a solution that we have to add our Cluster manually to the LENS DESKTOP by following ways : 1 . in your WSL command line start the minikube cluster .... by
minikube start
command 2. then runkubectl config view
your config file will be visible ..... 3. if kubectl is not installed then you have to go manually to config path\\wsl.localhost\Ubuntu-20.04\home\${your username}\.kube\config
4. then copy that config file and paste in lens ---> add cluster (ctrl+shift+a
) ..... 5. edit your config file and add\\wsl.localhost\Ubuntu-{your version}\
before\home
atcertificate-authority
,client-certificate
,client-key
6. after edit the config file : 7. add clusterYour minikube will be visible on lens desktop
NOTE:-
MINIKUBE CLUSTER MUST BE STARTED
Thank you shivankur 🔥 It worked!!! May i know how to sync that path as default manually? cause if i try to sync that via lens it says "you cannot select this location".
server: https://127.0.0.1:51887 name: minikube contexts:
For the time being I wanted to share my workaround: https://github.com/turikhay/minikube-lens-k8s-config-rewriter
The issue is with the configuration paths and certificate paths.
For me when I try to apply the above solutions, my LENS get's stuck at "connecting"
I have the same issue. I followed the steps @Shivankur25 indicated earlier by copying over the contents of .kube/config file in wsl2 to Openlens config file. BTW, I also opened proxy connection in cmd on my windows machine kubectl proxy --port 8001 --reject-paths "^/api/./pods/./attach"
and added the proxy URL 127.0.0.1:800
in Openlens, but now when it connects to the cluster I am getting the following error
To resolve issues with certificate paths:
minikube start --embed-certs
I was also having problem and my cluster was not visible on lens : Then I found a solution that we have to add our Cluster manually to the LENS DESKTOP by following ways : 1 . in your WSL command line start the minikube cluster .... by
minikube start
command 2. then runkubectl config view
your config file will be visible ..... 3. if kubectl is not installed then you have to go manually to config path\\wsl.localhost\Ubuntu-20.04\home\${your username}\.kube\config
4. then copy that config file and paste in lens ---> add cluster (ctrl+shift+a
) ..... 5. edit your config file and add\\wsl.localhost\Ubuntu-{your version}\
before\home
atcertificate-authority
,client-certificate
,client-key
6. after edit the config file : 7. add clusterYour minikube will be visible on lens desktop
NOTE:-
MINIKUBE CLUSTER MUST BE STARTED
thnk u for the help it worked for me
reminder : add \\wsl.localhost\Ubuntu\
before \home
at certificate-authority
, client-certificate
, client-key
Adding ubuntu version is not necessary
Describe the bug Hello Everyone,
My setup:
Windows 10 WSL2 Docker, kubectl, minikube I am trying to get Lens 5 to connect to the minikube cluster inside WSL2 but it won't work. I get the following error when pointing Lens to "\wsl$\Ubuntu\home\MYUSER.kube\config".
Has anyone been able to successfully connect Lens 5 to a K8s cluster inside a WSL2 (w/ Ubuntu 20.04) ?
To Reproduce Steps to reproduce the behavior:
Expected behavior Lens 5 should recognize the ".kube/config" and connect to the Minikube cluster.
Screenshots Not applicable
Environment (please complete the following information):
Logs: When you run the application executable from command line you will see some logging output. Please paste them here:
Kubeconfig: Quite often the problems are caused by malformed kubeconfig which the application tries to load. Please share your kubeconfig, remember to remove any secret and sensitive information.
Additional context Any help getting Lens 5 to connect to a Minikube cluster inside WSL2 is appreciated. Thank you all in advance.