<p>Is there any command which points me to the path where kubeconfig file is present?
I mean I am working on python k8s/openshift client. I am looking for linux or python command or libraries which can print me the path where kubeconfig file is present.</p>
<p>By default kubeconfig is present it home most of the time, but it may also vary for different deployment types.</p>
<p>looking forward to any suggestions/concerns.</p>

majid asad
<p>kubectl configuration file is located at ~/. kube/config as default. You can check using this code</p>
<pre><code>kubeconfig_path = os.environ.get('KUBECONFIG', '~/.kube/config')
</code></pre>
<p>You can check if the variable is set</p>
<pre><code>kubeconfig_path = os.environ['KUBECONFIG']
</code></pre>
<p>and if it's not you can try setting this</p>
<pre><code>os.environ[&quot;KUBECONFIG&quot;]=your_config_file_path
</code></pre>
