Merging Kube Config Files

See https://github.com/bitnami-labs/kubectl-import

We are going to merge our .kube/config files using a script created by bitnami.

Install kubectl-import

$ sudo curl -o /usr/local/bin/kubectl-import https://raw.githubusercontent.com/bitnami-labs/kubectl-import/master/kubectl-import && sudo chmod 0755 /usr/local/bin/kubectl-import


WSL Setup

If you are using WSL with Docker for Desktop, you may want to link your .kube folder from Windows to your WSL instance. 

mv ~/.kube ~/.kube.old
ln -s /mnt/c/Users/mehan/.kube .kube


Merge Files

Download the .kube/ folder from the current client and then issue the following command:

kubectl-import config

After importing, you may need to fix file paths in the newly updated ~/.kube/config file and copy over any additional files reference in the new config.


Using Kubectl Config

View Contexts

$ kubectl config get-contexts

CURRENT   NAME             CLUSTER           AUTHINFO         NAMESPACE
*         docker-desktop   docker-desktop    docker-desktop
          vlab             bcmt-kubernetes   ncm-admin        default


Switch Context

$ kubectl config use-context docker-desktop
Switched to context "docker-desktop".