10.2. 在安装过程中配置代理
当您使用 roxctl
命令行界面(CLI)或 Helm 安装 Red Hat Advanced Cluster Security for Kubernetes 时,您可以在安装过程中指定代理配置。
当使用 roxctl central generate
命令运行安装程序时,安装程序会为您的环境生成 secret 和部署配置文件。您可以通过编辑生成的配置 secret (YAML)文件来配置代理。目前,您无法使用 roxctl
CLI 配置代理。配置存储在 Kubernetes secret 中,它由 Central 和 Scanner 共享。
流程
从部署捆绑包目录中打开配置文件
central/proxy-config-secret.yaml
。注意如果使用 Helm,则配置文件位于
central/templates/proxy-config-secret.yaml
中。编辑配置文件中您要修改的字段:
apiVersion: v1 kind: Secret metadata: namespace: stackrox name: proxy-config type: Opaque stringData: config.yaml: |- 1 # # NOTE: Both central and scanner should be restarted if this secret is changed. # # While it is possible that some components will pick up the new proxy configuration # # without a restart, it cannot be guaranteed that this will apply to every possible # # integration etc. # url: http://proxy.name:port 2 # username: username 3 # password: password 4 # # If the following value is set to true, the proxy wil NOT be excluded for the default hosts: # # - *.stackrox, *.stackrox.svc # # - localhost, localhost.localdomain, 127.0.0.0/8, ::1 # # - *.local # omitDefaultExcludes: false # excludes: # hostnames (may include * components) for which you do not 5 # # want to use a proxy, like in-cluster repositories. # - some.domain # # The following configuration sections allow specifying a different proxy to be used for HTTP(S) connections. # # If they are omitted, the above configuration is used for HTTP(S) connections as well as TCP connections. # # If only the `http` section is given, it will be used for HTTPS connections as well. # # Note: in most cases, a single, global proxy configuration is sufficient. # http: # url: http://http-proxy.name:port 6 # username: username 7 # password: password 8 # https: # url: http://https-proxy.name:port 9 # username: username 10 # password: password 11
- 3 4 7 8 10 11
- 在开始以及在
http
和https
部分中,添加username
和password
是可选的。 - 2 6 9
url
选项支持以下 URL 方案:-
HTTP 代理的 HTTP
://
。 -
用于支持 TLS 的 HTTP 代理的 HTTPS://
。 -
适用于 SOCKS5 代理的
socks5://
。
-
HTTP 代理的 HTTP
- 5
excludes
列表可以包含 DNS 名称(带有或没有*
通配符)、IP 地址或 CIDR 表示法中的 IP 块(例如10.0.0.0/8
)。此列表中的值将应用到所有传出连接,而不考虑协议。- 1
stringData
部分中的|-
行表示配置数据的开头。注意-
第一次打开文件时,所有值都会注释掉(使用行首的
#
符号)。以双 hash 符号(# #
)开头的行包含配置键的说明。 -
在编辑字段时,您维护了一个相对于
config.yaml: |-
行的缩进级别两个空格。
-
第一次打开文件时,所有值都会注释掉(使用行首的
- 编辑配置文件后,您可以继续正常安装。更新的配置指示 Red Hat Advanced Cluster Security for Kubernetes 使用在提供的地址和端口号中运行的代理。