Kubernetes Docker Containers behind proxy Kubernetes Docker Containers behind proxy kubernetes kubernetes

Kubernetes Docker Containers behind proxy


The reason of that state is that environment variables with proxy are feature of docker client. Docker is divided into 2 parts: API exposed on socket by docker daemon and docker client CLI using which you can run container docker run.... so that command will hit docker daemon API making 'something'. Sadly Kubernetes is another API client what means that Kubernetes doesn't use docker client to schedule container (Kubernetes access API directly using SDK) so that's why you don't see expected environment variables.

To work around that problem I would suggest to create ConfigMap with that proxy values e.g.

apiVersion: v1kind: ConfigMapmetadata:  name: your-config-map-name  labels:    app: your-best-appdata:  HTTPS_PROXY: http://ssnproxy.ssn.xxx.com:80/  HTTP_PROXY: http://ssnproxy.ssn.xxx.com:80/

and mount them to deployment as environment variables using

envFrom:  - configMapRef:      name: your-config-map-name