<p>I would like to merge multiple kubeconfig files into one config file.I am using Windows 10 and PS for commnand line. I have 3 config files in <code>$HOME\.kube\config</code> directory and I set a <em>KUBECONFIG</em> environment variable with <code>C:\Users\Username\.kube.\config</code></p>

<p>I tried below command as below but I received an error says:</p>

<blockquote>
  <p>KUBECONFIG=$HOME.kube\config:$HOME.kube\c1.kubeconfig\$HOME.kube\c2.kubeconfig : The module 'KUBECONFIG=$HOME' could not be loaded. For more information, run 'Import-Module KUBECONFIG=$HOME'. At line:1 char:1
  + KUBECONFIG=$HOME.kube\config:$HOME.kube\c1.kubeconfig\$HOME.k ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (KUBECONFIG=$HOM...2.kubeconfig:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CouldNotAutoLoadModule</p>
</blockquote>

<pre><code>KUBECONFIG=$HOME\.kube\config:$HOME\.kube\c1.kubeconfig\$HOME\.kube\c2.kubeconfig kubectl config view --merge --flatten $HOME\.kube\merged_kubeconfig
</code></pre>

<p>My Folder structure as below.</p>

<pre><code>.kube
  -c1.kubeconfig
  -c2.kubeconfig
  -config
</code></pre>

semural
<p>Resolved issue with merging kubeconfig files using below command for Windows</p>

<pre><code>$Env:KUBECONFIG=("$HOME\.kube\config;$HOME\.kube\c1.kubeconfig;$HOME\.kube\c2.kubeconfig"); kubectl config view --merge --flatten | Out-File "C:\Users\SU\tmp\config"
</code></pre>
