Difference between revisions of "Merge multiple kubeconfigs"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
1) Make a backup of your current <code>[~/.kube/config]]</code> | 1) Make a backup of your current <code>[~/.kube/config]]</code> | ||
cp [[~/.kube/config]] ~/.kube/config.BAK.$([[date '+%Y-%m-%d_%H%M']]) | cp [[~/.kube/config]] ~/.kube/config.BAK.$([[date '+%Y-%m-%d_%H%M']]) | ||
− | [[kubectl konfig]] merge file1.yml file2.yml > | + | [[kubectl konfig]] merge file1.yml file2.yml > merged_kubeconfig.yml |
for CLUSTER in $([[rancher cluster ls]] | grep -v NAME | cut -d"*" -f2- | awk '{print $3}' ); do [[rancher cluster kubeconfig]] $CLUSTER > $CLUSTER.kubeconfig; done | for CLUSTER in $([[rancher cluster ls]] | grep -v NAME | cut -d"*" -f2- | awk '{print $3}' ); do [[rancher cluster kubeconfig]] $CLUSTER > $CLUSTER.kubeconfig; done |
Revision as of 09:45, 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') kubectl konfig merge file1.yml file2.yml > merged_kubeconfig.yml
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'
See also
Advertising: