Using a proxy in the CRI-O container runtime
To use an HTTP or HTTPS proxy in CRI-O, you can add a systemd Service drop-in file that defines the HTTP_PROXY, HTTPS_PROXY, and optional NO_PROXY environment variables. You can reload systemd, restart crio, and restart the MicroShift service so the proxy settings apply.
-
Create the directory for the configuration file if it does not exist:
$ sudo mkdir /etc/systemd/system/crio.service.d/ -
Add the following settings to the
/etc/systemd/system/crio.service.d/00-proxy.conffile:[Service] Environment=NO_PROXY="localhost,127.0.0.1" Environment=HTTP_PROXY="http://$PROXY_USER:$PROXY_PASSWORD@$PROXY_SERVER:$PROXY_PORT/" Environment=HTTPS_PROXY="http://$PROXY_USER:$PROXY_PASSWORD@$PROXY_SERVER:$PROXY_PORT/"You must define the
Servicesection of the configuration file for the environment variables or the proxy settings fail to apply. -
Reload the configuration settings:
$ sudo systemctl daemon-reload -
Restart the CRI-O service:
$ sudo systemctl restart crio -
Restart the MicroShift service to apply the settings:
$ sudo systemctl restart microshift
-
Verify that pods are started by running the following command and examining the output:
$ oc get all -A -
Verify that MicroShift is able to pull container images by running the following command and examining the output:
$ sudo crictl images