How to access local kubernete cluster

11/11/2020

I have deployed 1 master and 3 nodes on VM's. I can run successfully "kubectl" command on the server's SSH CLI. I can deploy pods, all fine.

But I couldn't find how can I run "kubectl" command from my local and manage the K8S cluster? How can I do that?

Thanks!

-- yatta
kubernetes

2 Answers

11/11/2020

You might have a kubeconfig file somewhere on the VMs. You can copy this one to your local device under $HOME/.kube/config, so kubectl knows how to access the cluster.

For more information, see the kubernetes documentation.

-- mlang
Source: StackOverflow

11/11/2020

From your local machine run:

kubectl config get-contexts

Then run the below (replace cluster-name with the cluster name you want to communicate with):

kubectl config use-context cluster-name

If the cluster name you want to communicate with is not listed, it means you haven't got to context file to the cluster.

-- m8usz
Source: StackOverflow