I've tried many solutions from different sources. But nothing has worked for me. I also double-checked my kubeconfig in Lens to ensure it's using the correct configuration. From my local terminal, kubectl
works without any issues.
The problem, in my case, turned out to be that Lens was being executed from a different user or environment than the one where kubectl
is configured properly.
So, if all of your steps also match up but you're still having problems, one thing you can try is launching Lens directly from the terminal where you know kubectl
has access.
Before you do this, make sure to completely quit Lens.
On macOS:
open -a Lens
On Linux, just type:
lens
That approach worked for me.