I am running into a few issues when trying to get my local kubectl to point to clusters created with kubeadm:
$KUBECONFIG
.It seems like I am limited to modifying the contents of the ~/.kube/config
file through string manipulation (gross), which I would like to avoid!! Does anyone have a solution for this?
At the moment, as far as I am aware, there is no tool that would automatically merge different kube config files into one, which is effectively what you need. Personally I do manipulate the .kube/config manually with a text editor. It's not that much of work in the end.
One option you have is to use different config files for your clusters. Create one file for each cluster and put them in a directory (I use ~/.kube
) giving them meaningful names that help you distinguish them (you can use a cluster identifier for instance).
Then, you can set the KUBECONFIG
environment variable to choose a different configuration file when you run kubectl, such as:
KUBECONFIG=/path/to/the/config/file kubectl get po
You can also create aliases in your favourite shell to avoid writing all of the above command.
alias mykube="KUBECONFIG=/path/to/the/config/file kubectl get po"
mykube get po