<p>When I'm using <code>kubectl</code> on top of Kubernetes. I can view contents of <code>KUBECONFIG</code> file like this:</p>
<pre class="lang-sh prettyprint-override"><code>$ kubectl config view
</code></pre>
<p>Is there any way I can find out which I can find out the location of <code>KUBECONFIG</code> file <code>kubectl</code> is using? I'm looking for something like:</p>
<pre class="lang-sh prettyprint-override"><code>$ kubectl config get-location
/path/to/kube-config/file
</code></pre>

Rohan Kumar
<p>The kubeconfig directory is default to <code>$HOME/.kube/config</code>. But it can be overwritten by <code>$KUBECONFIG</code> env.</p>
<p>To get your kubeconfig directory, run:</p>
<pre class="lang-sh prettyprint-override"><code>$ [[ ! -z &quot;$KUBECONFIG&quot; ]] &amp;&amp; echo &quot;$KUBECONFIG&quot; || echo &quot;$HOME/.kube/config&quot;
</code></pre>
<p><strong>What it does?</strong> If <code>$KUBECONFIG</code> is set, print the value. Otherwise, print the default value.</p>
