export KUBECONFIG=~/.kube/config:/path/to/new/config
kubectl config view --flatten > /tmp/config
#copy this file (/tmp/config) to ~/.kube/config or export it to use
mv /tmp/config ~/.kube/config
# If you already have multiple config files to connect to different clusters, you would like to merge them first. You can merge both the config file using syntax below
# Merge ~/.kube/config and ~/.kube/devClusterConfig in to new config /tmp/config
$ KUBECONFIG=~/.kube/config:~/.kube/devClusterConfig kubectl config view --flatten > /tmp/config
# Replace old config with new merged config
$ mv /tmp/config ~/.kube/config
#Switching the Kubernetes clusters using kubectl commands
$ kubectl config get-contexts
$ kubectl config use-context qa-aks-cluster