How to configure kubectl with cluster information from a .conf file?

Assen Kolov picture Assen Kolov · Nov 6, 2016 · Viewed 80.7k times · Source

I have an admin.conf file containing info about a cluster, so that the following command works fine:

kubectl --kubeconfig ./admin.conf get nodes

How can I config kubectl to use the cluster, user and authentication from this file as default in one command? I only see separate set-cluster, set-credentials, set-context, use-context etc. I want to get the same output when I simply run:

kubectl get nodes

Answer

Gleeb picture Gleeb · Nov 6, 2016

Here are the official documentation for how to configure kubectl

http://kubernetes.io/docs/user-guide/kubeconfig-file/

You have a few options, specifically to this question, you can just copy your admin.conf to ~/.kube/config