<p>I have setup a Kubernetes cluster which somehow cannot have internet connectivity because of organizaion policies. Now there are some services which I need to communicate via internet. To resolve this I have setup a forward proxy (Squid) which is outside of K8s cluster. All the nodes of my K8s cluster can access "google.com" using forward proxy. But I am not able to make my pods communicate through that proxy.</p>

<p>I have setup following variable on all the master and worker nodes:</p>

<pre><code>export http_proxy="http://10.x.x.x:3128"
export https_proxy="https://10.x.x.x:3128"
</code></pre>

<p>I am able to curl google.com from master and worker nodes. But when I attach into my container I notice that there are no variable http_proxy and https_proxy. and it cannot perform successful curl.</p>

<p>My pods and service network is different than my VM network</p>

<pre><code>pod-network-cidr=192.167.0.0/16 
service-cidr 192.168.0.0/16 
</code></pre>

<p>and my VM network is like:</p>

<pre><code>Master  -&gt; 10.2.2.40
Worker1 -&gt; 10.2.2.41
Worker2 -&gt; 10.2.2.42
Worker3 -&gt; 10.2.2.43
</code></pre>

<p>And my forward proxy is running at</p>

<pre><code>Forward Proxy: 10.5.2.30
</code></pre>

<p>I am using kubernetes version v1.11.2. Any help here like where should I put my http_proxy setting for kubernetes cluster to make it effective for all pods and services?</p>

<p>So I figured it out that to set the proxy for particular containers, set the env variable in Dockerfile.</p>

<pre><code>ENV HTTP_PROXY http://10.x.x.x:PORT
</code></pre>
