I have a squid proxy installed in one of the AWS ec2 instance and pod running in kubernetes cluster.
I have added the env variable in deployment.yaml file to export the squid proxy LB as below
env:
-
name: http_proxy
value: "http://XXXX:3128"
-
name: https_proxy
value: "http://XXXX:3128"
I can see the access denied if i do a curl request from kubernetes pod console.
curl -k google.com
The request is not routing to squid proxy if I try to access from the application running in kubernetes pod
Can anyone suggest where I am doing wrong?
How to route all requests from the application running in pod to squid proxy?
You can try next:
1) Fix this on docker.service.d level by creating /etc/systemd/system/docker.service.d/http-proxy.conf
with following content:
[Service]
Environment="HTTP_PROXY=http://XXXX:3128"
Environment="HTTPS_PROXY=http://XXXX:3128"
Dont forget do afterwards
systemctl daemon-reload
systemctl restart docker
2)If you use own image, you can build it with specifying below in Dockerfile. With this approach only current container will use your squid proxy
ENV http_proxy XXXX:3128
ENV https_proxy XXXX:3128
3) Another way is to look into /etc/default/docker
(For ubuntu):
cat /etc/default/docker
...
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/
This way you will set up set up proxy for ALL containers and not for only chosen one
I have also found some github kubernetes-squid sulotion. PLease take a lokk, but I feel that this is not you need, but anyway..
Hope it helps