<p>As of now i do</p>
<pre><code> kubectl  --context &lt;cluster context&gt; get pod  -A 
</code></pre>
<p>to get pod in specific cluster</p>
<p>is there a python way to set kubernetes context for a virtual env , so we can use multiple context at the same time
example :</p>
<pre><code>Terminal 1:
(cluster context1) user@machine # 

Terminal 2:
(cluster context2) user@machine #
</code></pre>
<p>This should be equivalent of</p>
<pre><code>Terminal 1:
user@machine #  kubectl  --context &lt;cluster context1&gt; get pod  -A 

Terminal 2:
user@machine # kubectl  --context &lt;cluster context1&gt; get pod  -A 
</code></pre>

Pradeep Padmanaban C
<p>This isn't probably a rational solution, but anyway... At some time I used different <code>kubectl</code> versions for different clusters and I came up with a venv-like solution to switch between them. I wrote text files like this:</p>
<pre class="lang-sh prettyprint-override"><code>export KUBECONFIG=&quot;/path/to/kubeconfig&quot;
export PATH=&quot;/path/including/the/right/kubectl&quot;
</code></pre>
<p>And activated them in the same fashion as venv: <code>source the_file</code>. If you can split your contexts to separate files, you can add <code>export KUBECONFIG=&quot;/path/to/kubeconfig&quot;</code> to your <code>venv/bin/activate</code> and it will use the desired config when you activate the <code>venv</code>.</p>
