Layne Wu
Layne Wu

Reputation: 97

How to access k8s on another host from one linux machine

Now i did three things: First, install kubectl on one linux machine, Second, copy the admin.conf file from the remote k8s server to the ~/.kube/ file on the linux host, Third, running kubectl get nodes under Linux reports an error. .

wanlei@kf-test:~/.kube$ kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

I want to know what steps I have missed. . The goal is to use kubectl from my linux host to manage k8s on the remote host

Upvotes: 1

Views: 172

Answers (1)

Arghya Sadhu
Arghya Sadhu

Reputation: 44657

You need to place the kubeconfig file at .kube/config location i.e there should be a file with name config at .kube directory.That's where kubectl looks for the kubeconfig file by default.

Alternative to above would be defining KUBECONFIG environment variable to point to a kubeconfig file in a different location.

Upvotes: 4

Related Questions