kubectl context like a pro
If your work involves working with multiple Kubernetes clusters, then this might be for you. ☸️ A file that is used to configure access to a cluster is called kubeconfig(usually placed at ~/.kube/c...

Source: DEV Community
If your work involves working with multiple Kubernetes clusters, then this might be for you. ☸️ A file that is used to configure access to a cluster is called kubeconfig(usually placed at ~/.kube/config), but you can easily override the location by using --kubeconfig=<path_to_config> flag or using KUBECONFIG environment variable export KUBECONFIG=<path/to/your_kubeconfig>. A Kubernetes config file describes clusters, users, and contexts. You can use multiple contexts to target different Kubernetes clusters. apiVersion: v1 kind: Config preferences: {} clusters: - cluster: name: <cluster_name> ... users: - name: <user_name> ... contexts: - context: name: <context_name> You can render your current config: kubectl config view. Without further ado, let's take the example of merging two config files(one for each cluster): # create backup for current config cp ~/.kube/config ~/.kube/config.bak # merge the 2 configs KUBECONFIG=~/.kube/config:/path/to/new/config ku