<p>I am setting <code>KUBECONFIG</code> variable, but kubectl is not using this variable and instead using the default config file.</p>
<p>Setting variable as below -</p>
<pre><code>$export KUBECONFIG=./my-k8s-token.config 
</code></pre>
<p>next am running get pods as below -</p>
<pre><code>$ kubectl.exe get pods -v 8
I1211 22:08:39.175597    1920 loader.go:359] Config loaded from file C:\Users\myuserhome/.kube/config
I1211 22:08:39.186378    1920 round_trippers.go:416] GET https://kubernetes.docker.internal:6443/api/v1/namespaces/default/pods?limit=500
I1211 22:08:39.187586    1920 round_trippers.go:423] Request Headers:
</code></pre>
<p>As you can see above, kubectl is still using the default config file: <code>C:\Users\myuserhome/.kube/config</code>.</p>
<p>How can i fix this. How can i make kubectl read the config file from KUBECONFIG variable.</p>
<p>Note: If you are wondering why there is .exe extension for kubectl, the answer is I am using WSL2 with Ubuntu.</p>

<p>I could solve the issue by using <code>kubectl</code> which i installed using offical documentation - <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management</a>.</p>
<p>Now on using kubectl instead of kubectl.exe I am able to use KUBECONFIG env variable.</p>
