How Can I Connect to My Remote Kubernetes Cluster Using kubectl?

0
3
Asked By CuriousCat92 On

Hey everyone! I'm trying to connect to my Kubernetes cluster from my computer running Ubuntu. I've installed `kubectl`, downloaded the configuration file from the master node, and saved it at `/home/user/.kube/config`. However, whenever I attempt to connect with the command `kubectl get nodes -o wide`, I get an error that says I need to specify either client-key-data or client-key for clientCert authentication. I'm pretty new to DevOps and would love any help you can provide!

1 Answer

Answered By TechieTom123 On

First off, it seems like you didn't actually place the config file correctly. You can create a kubeconfig file with a name like 'name.kubeconfig' instead and then set the environment variable by running `export KUBECONFIG=/path/to/name.kubeconfig`.

Also, make sure your personal desktop can reach the kube-apiserver. For example, if your kube-apiserver's IP is 10.0.0.1, your desktop needs to be able to connect to that IP.

CuriousCat92 -

Awesome! Thank you so much for the tips! I set the environment variable and added the IP and DNS to /etc/hosts.

HelpSeeker86 -

Can I ask another question? I installed K9s and followed the official instructions. I can see the cluster using `kubectl` from my local desktop, but it doesn't show up in K9s. Do I need to set environment variables for K9s, too?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.