<p>I am trying to build a kubernetes python app using a docker container but keep getting this error. </p>

<pre><code>if os.getenv('KUBERNETES_SERVICE_HOST'):
    config.load_incluster_config()
else:
    config.load_kube_config()
</code></pre>

<p>However, the file exists </p>

clout_chaser
<p>Where is the .kube/config file? in host directory or in container ? </p>

<p>As far as I know, in a container we normally use the incluster_config to connect to the api server, if we have the env  KUBERNETES_SERVICE_HOST configured, which injected into the pod by kubelet automatically. So try to setup the env KUBERNETES_SERVICE_HOST when you start the container.</p>
