<p>I cannot connect to internet from pods. My kubernetes cluster is behind proxy.<br>
I have already set <code>/env/environment</code> and <code>/etc/systemd/system/docker.service.d/http_proxy.conf</code>, and confirmed that environment variables(<code>http_proxy</code>, <code>https_proxy</code>, <code>HTTP_PROXY</code>, <code>HTTPS_PROXY</code>, <code>no_proxy</code>, <code>NO_PROXY</code>) are correct.
But in the pod, when I tried <code>echo $http_proxy</code>, answer is empty. I also tried <code>curl -I https://rubygems.org</code> but it returned <code>curl: (6) Could not resolve host: rubygems.org</code>.<br>
So I think pod doesn't receive environment values correctly or there is something I forget to do what I should do. How should I do to solve it?</p>

<p>I tried to <code>export http_proxy=http://xx.xx.xxx.xxx:xxxx; export https_proxy=...</code>.<br>
After that, I tried again <code>curl -I https://rubygems.org</code> and I can received header with 200.</p>

<p>What I see is that you have wrong  <code>proxy.conf</code> name.
As per <a href="https://docs.docker.com/config/daemon/systemd/" rel="nofollow noreferrer">official documention</a> the name should be <code>/etc/systemd/system/docker.service.d/http-proxy.conf</code>and not <code>/etc/systemd/system/docker.service.d/http_proxy.conf</code>.</p>

<p>Next you add proxies, reload daemon and restart docker, as mentioned in provided in comments <a href="https://stackoverflow.com/questions/53173487/how-to-set-proxy-settings-http-proxy-variables-for-kubernetes-v1-11-2-cluste">another answer</a></p>

<p><code>/etc/systemd/system/docker.service.d/http_proxy.conf</code>:</p>

<p>Content:</p>

<pre><code>    [Service]
    Environment="HTTP_PROXY=http://x.x.x:xxxx"
    Environment="HTTPS_PROXY=http://x.x.x.x:xxxx"

# systemctl daemon-reload
# systemctl restart docker
</code></pre>

<p>Or, as per <a href="https://stackoverflow.com/a/53209308/9929015">@mk_ska answer</a> you can </p>

<blockquote>
  <p>add http_proxy setting to your Docker machine in order to forward
  packets from the nested Pod container through the target proxy server.</p>
  
  <p>For Ubuntu based operating system:</p>
  
  <p>Add export http_proxy='http://:' record to the file
  /etc/default/docker</p>
  
  <p>For Centos based operating system:</p>
  
  <p>Add export http_proxy='http://:' record to the file
  /etc/sysconfig/docker</p>
  
  <p>Afterwards restart Docker service.</p>
</blockquote>

<p>Above will set proxy for all containers what will be used by docker engine</p>
