<p>I'm using <a href="https://github.com/rancher/rke" rel="noreferrer">rke</a> to generate a Kubernetes cluster in a private cloud. It produces a <code>kube_config_cluster.yml</code> file. Is there a way to add this config to my <code>$HOME/.kube/config</code> file?</p>

<p>Without having the .kube/config set, when using <code>kubectl</code>, I have to pass the argument:</p>

<pre><code>kubectl --kubeconfig kube_config_cluster.yml &lt;command&gt;
</code></pre>

<p>Or set the KUBECONFIG environment variable.</p>

<pre><code>export KUBECONFIG=kube_config_cluster.yml
</code></pre>

<p><code>kubectl config merge</code> command is <a href="https://github.com/kubernetes/kubernetes/issues/46381" rel="noreferrer">not yet available</a>. But you can achieve a config merge by running:</p>
<p><strong>Command format:</strong></p>
<pre><code>KUBECONFIG=config1:config2 kubectl config view --flatten
</code></pre>
<p><strong>Example:</strong></p>
<p>Merge a config to <code>~/.kube/config</code> and write back to <code>~/.kube/config-new.yaml</code>.</p>
<h3>Do not pipe directly to the config file! Otherwise, it will delete all your old content!</h3>
<pre><code>KUBECONFIG=~/.kube/config:/path/to/another/config.yml kubectl config view --flatten &gt; ~/.kube/config-new.yaml
</code></pre>
<p><code>cp ~/.kube/config-new.yaml ~/.kube/config</code></p>
