title: Issue Trying To Access Kubernetes API from Docker Container
body: <p>I am facing issue. I am trying to access Kubernetes API from Docker Container (Created .NetCore). I am getting Error Message <strong>"Connection Refused"</strong>.</p>
  
  <p>Can anyone help?
  I shall be thankful.</p>
  
  <pre><code>using (HttpClient client = new HttpClient()) {
    var request_json = JsonConvert.SerializeObject(obj).ToString();
    var content = new StringContent(request_json, Encoding.UTF8, "application/json");
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "Token");
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    client.DefaultRequestHeaders.Connection.Add("close");
    var result = await client.PostAsync("http://127.0.0.1:8001/apis/batch/v1/namespaces/default", content);
    var result_string = await result.Content.ReadAsStringAsync()`enter code here`;
    return result_string.ToString();
  }
  </code></pre>