Difference between revisions of "Merge multiple kubeconfigs"
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
== Related == | == Related == | ||
* <code>[[date]]: date '+%Y-%m-%d_%H%M'</code> | * <code>[[date]]: date '+%Y-%m-%d_%H%M'</code> | ||
− | * kubectl config get-contexts | + | * <code>[[kubectl config get-contexts]]</code> |
== See also == | == See also == |
Revision as of 09:49, 12 January 2024
Merge multiple ~/.kube/config
into one using kubectl konfig merge
1) Make a backup of your current [~/.kube/config]]
cp ~/.kube/config ~/.kube/config.BAK.$(date '+%Y-%m-%d_%H%M')
2) Use kubectl konfig merge
for merge files:
kubectl konfig merge kubeconfig1.yml kubeconfig2.yml > merged_kubeconfig
for CLUSTER in $(rancher cluster ls | grep -v NAME | cut -d"*" -f2- | awk '{print $3}' ); do rancher cluster kubeconfig $CLUSTER > $CLUSTER.kubeconfig; done
Related
date: date '+%Y-%m-%d_%H%M'
kubectl config get-contexts
See also
Advertising: