5.3. 在代理后面启动 Red Hat OpenShift Local

您可以使用环境变量或可配置属性在定义的代理后面启动 Red Hat OpenShift Local。

注意

OpenShift Container Platform 不支持 SOCKS 代理。

先决条件

  • 要在主机机器上使用现有 OpenShift CLI (oc)可执行文件,请将 .testing 域导出为 no_proxy 环境变量的一部分。嵌入式 oc 可执行文件不需要手动设置。有关使用嵌入式 oc 可执行文件的更多信息,请参阅使用 OpenShift CLI 访问 OpenShift 集群

流程

  1. 使用 http_proxyhttps_proxy 环境变量或使用 crc config set 命令定义代理,如下所示:

    $ crc config set http-proxy http://proxy.example.com:<port>
    $ crc config set https-proxy http://proxy.example.com:<port>
    $ crc config set no-proxy <comma-separated-no-proxy-entries>
  2. 如果代理使用自定义 CA 证书文件,请按如下所示对其进行设置:

    $ crc config set proxy-ca-file <path-to-custom-ca-file>
注意

Red Hat OpenShift Local 配置中设置的与代理相关的值优先于通过环境变量设置的值。