<p>I understand kubectl gets the kubeconfig file in the order</p>
<ol>
<li>command line option <code>--kubeconfig</code></li>
<li>environment variable <code>KUBECONFIG=</code></li>
<li>default path <code>~/.kube/config</code></li>
</ol>
<p>But is there a way to get the kubeconfig path/file details from the kubectl which one being currently used?</p>
<p>Something like <code>kubectl config path</code></p>

Logu
<p><strong>Question: But is there a way to get the kubeconfig path/file details from the kubectl which one being currently used?</strong></p>
<p>Yes, you can run any <code>kubectl</code> command with <code>verbose</code> level 6+ to see the <code>kubeconfig</code> in use.</p>
<pre><code>kubectl get pod   -v6                                             
I0629 04:48:25.050954   14444 loader.go:379] Config loaded from file:  /home/ps/.kube/config
I0629 04:48:25.146072   14444 round_trippers.go:445] GET https://kubemaster:6443/api/v1/namespaces/default/pods?limit=500 200 OK in 10 milliseconds
No resources found in default namespace.
</code></pre>
<p>Few examples demonstrating the same:</p>
<pre><code>kubectl get pod   -v6 2&gt;&amp;1 |awk  '/Config loaded from file:/{print $NF}'
/home/ps/.kube/config
</code></pre>
<p>Changed the<code>kubeconfig</code> to <code>/tmp/config</code></p>
<pre><code>export KUBECONFIG=/tmp/config    
kubectl get pod   -v6 2&gt;&amp;1 |awk  '/Config loaded from file:/{print $NF}'
/tmp/config
</code></pre>
<p>Remove the <code>awk</code> command to see the whole output.</p>
<p>Windows output:</p>
<p><a href="https://i.stack.imgur.com/5GLxT.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/5GLxT.jpg" alt="enter image description here" /></a></p>
