第10章 外部ネットワークアクセス用のプロキシーの設定
ネットワーク設定でプロキシー経由のアウトバウンドトラフィックが制限されている場合は、Red Hat Advanced Cluster Security for Kubernetes でプロキシー設定を設定して、プロキシー経由でトラフィックをルーティングできます。
Red Hat Advanced Cluster Security for Kubernetes でプロキシーを使用する場合:
- Central および Scanner からのすべての出力 HTTP、HTTPS、およびその他の TCP トラフィックは、プロキシーを通過します。
- Central と Scanner 間のトラフィックはプロキシーを通過しません。
- プロキシー設定は、他の Red Hat Advanced Cluster Security for Kubernetes コンポーネントには影響しません。
オフラインモードを使用しておらず、セキュアクラスターで実行されている Collector が実行時に追加の eBPF プローブをダウンロードする必要がある場合:
- Collector は Sensor に接続してダウンロードを試みます。
- 次に、Sensor はこのリクエストを Central に転送します。
-
Central はプロキシーを使用して、
https://collector-modules.stackrox.ioでモジュールまたはプローブを見つけます。
10.1. 既存のデプロイメントでのプロキシーの設定 リンクのコピーリンクがクリップボードにコピーされました!
既存のデプロイメントでプロキシーを設定するには、proxy-config シークレットを YAML ファイルとしてエクスポートし、そのファイルのプロキシー設定を更新して、シークレットとしてアップロードする必要があります。
OpenShift Container Platform クラスターにグローバルプロキシーを設定している場合、Operator Lifecycle Manager (OLM) はクラスター全体のプロキシーで管理する Operator を自動的に設定します。ただし、インストールされた Operator をグローバルプロキシーをオーバーライドするか、カスタム認証局 (CA) 証明書を注入するように設定することもできます。
詳細は、Operator Lifecycle Manager でのプロキシーサポートの設定 を参照してください。
手順
既存のシークレットを YAML ファイルとして保存します。
$ oc -n stackrox get secret proxy-config \ -o go-template='{{index .data "config.yaml" | \ base64decode}}{{"\n"}}' > /tmp/proxy-config.yamlYAML 設定ファイルで変更するフィールドを編集します。以下に例を示します。
# # 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 # username: username # password: password # # 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 # # 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 # username: username # password: password # https: # url: http://https-proxy.name:port # username: username # password: password変更を保存した後、次のコマンドを実行してシークレットを置き換えます。
$ oc -n stackrox create secret generic proxy-config \ --from-file=config.yaml=/tmp/proxy-config.yaml -o yaml --dry-run | \ oc label -f - --local -o yaml app.kubernetes.io/name=stackrox | \ oc apply -f -
- OpenShift Container Platform が変更を Central と Scanner に伝播するまで少なくとも 1 分待つ必要があります。
- プロキシー設定を変更した後に発信接続に問題が発生した場合は、Central Pod と Scanner Pod を再起動する必要があります。