title: how can I load configuration for kubernetes using kubernetes-client. Google Cloud
body: <p>I have TS application that uses kubernetes-client library to connect to kubernetes in Google Cloud.</p>
  <pre><code>import { KubeConfig, CoreV1Api } from &quot;@kubernetes/client-node&quot;;
  const kc = new KubeConfig();
  kc.loadFromDefault();
  const kbsCoreApi = kc.makeApiClient(CoreV1Api);
  </code></pre>
  <p>When running locally works great, but when I dockerize it, it does not work due to not knowing how to load configuration. I tried to create a config file and load it using &quot;kc.loadFromFile('~/some/path')&quot; instead but It seems that I am missing something it gives me a HTTP error. Here is my configuration file.</p>
  <pre><code>    {
    &quot;kind&quot;: &quot;Config&quot;,
    &quot;apiVersion&quot;: &quot;v1&quot;,
    &quot;clusters&quot;: [
      {
        &quot;name&quot;: &quot;cluster1&quot;,
        &quot;cluster&quot;: {
          &quot;certificate-authority-data&quot;: &quot;cert-data&quot;,
          &quot;server&quot;: &quot;https://128.1.1.2&quot;
        }
      }
    ],
    &quot;users&quot;: [
      {
        &quot;name&quot;: &quot;cluster1&quot;,
        &quot;user&quot;: {
          &quot;password&quot;: &quot;myPassword&quot;,
          &quot;usernmae&quot;: &quot;myUsername&quot;
        }
      }
    ],
    &quot;contexts&quot;: [
      {
        &quot;name&quot;: &quot;cluster1&quot;,
        &quot;context&quot;: {
          &quot;cluster&quot;: &quot;cluster1&quot;,
          &quot;user&quot;: &quot;cluster1&quot;
        }
      }
    ],
    &quot;current-context&quot;: &quot;cluster1&quot;
  }
  </code></pre>