4.2 Using Kubernetes With a Proxy Server

In environments where a proxy server is configured to access the internet services, such as the Docker Hub or the Oracle Container Registry, you may need to perform several configuration steps to get Kubernetes to install and to run correctly.

  1. Ensure that the Docker engine startup configuration on each node in the cluster is configured to use the proxy server. For instance, create a systemd service drop-in file at /etc/systemd/system/docker.service.d/http-proxy.conf with the following contents:

    [Service]
    Environment="HTTP_PROXY=http://proxy.example.com:80/"
    Environment="HTTPS_PROXY=https://proxy.example.com:443/"

    Replace http://proxy.example.com:80/ with the URL for your HTTP proxy service. If you have an HTTPS proxy and you have specified this as well, replace https://proxy.example.com:443/ with the URL and port for this service. If you have made a change to your Docker systemd service configuration, run the following commands:

    # systemctl daemon-reload; systemctl restart docker
  2. You may need to set the http_proxy or https_proxy environment variables to be able to run other commands on any of the nodes in your cluster. For example:

    # export http_proxy="http://proxy.example.com:80/"
    # export https_proxy="https://proxy.example.com:443/"
  3. Disable the proxy configuration for the local host and any node IPs in the cluster:

    # export no_proxy="127.0.0.1, 192.0.2.10, 192.0.2.11, 192.0.2.12"

These steps should be sufficient to enable the deployment to function normally. Use of a transparent proxy that does not require configuration on the host and which ignores internal network requests, can reduce the complexity of the configuration and may help to avoid unexpected behavior.