Add a local cluster#
Lens K8S IDE uses kubeconfig files to connect to Kubernetes clusters from your local filesystem. By default, Lens K8S IDE automatically detects kubeconfig files located in the ~/.kube/ directory.
To view clusters specified in kubeconfig files, click Kubernetes Clusters > Local Kubeconfigs in Navigator.
Add kubeconfig files#
In addition to the default automatic sync, you can add more clusters through the Lens K8S IDE interface using one of the methods below.
Manually add a kubeconfig#
Use this method to register a cluster by pasting the raw kubeconfig content into a modal, for example when the file lives in a password manager, a vault, or a location you do not want Lens to watch continuously.
- In Navigator, click Kubernetes Clusters > Local Kubeconfigs.
- Click Add Kubeconfigs > Add kubeconfig by pasting.
- In the modal that opens, paste the contents of your kubeconfig file into the input field.
- Click Add Clusters.
The same modal is reachable from the Onboarding wizard Step 2 > Manually add kubeconfig button.
Tip
Lens K8S IDE saves the configurations and creates a kubeconfig file in the kubeconfigs directory of the application: ~/.lens/kubeconfigs.
Import a kubeconfig from filesystem#
Use this method when you want Lens to read kubeconfig files directly from a folder on disk.
- Open Preferences > Kubernetes > Manage Kubeconfigs.
- Click Add from filesystem.
- Select a kubeconfig file from your local filesystem.
Lens K8S IDE displays clusters specified in the kubeconfig file in Kubernetes Clusters > Local Kubeconfigs.
Manage Kubeconfigs#
Right-click on Local Kubeconfigs and select Manage Kubeconfigs to open Preferences > Kubernetes. In this menu you can configure kubectl, specify kubeconfig files, and manage Helm chart repositories.
Troubleshooting#
Problems with adding or connecting to local clusters#
When having problems with connecting to a local cluster:
-
Check the cluster configurations in Terminal:
kubectl config view --minify --raw -
Update your Kubernetes tools (
kubectl,aws cli,eksctl,gcloud) - Generate new kubeconfig file for the cluster
Issues with old Kubernetes versions#
For Kubernetes clusters older than version 1.24:
- Update the
apiVersionfield of theuserdefinition fromclient.authentication.k8s.io/v1alpha1toclient.authentication.k8s.io/v1beta1 - Review the rest of the kubeconfig file and adjust the configurations if necessary