LoginSignup
1
1

Proxy経由のOCP bastionサーバーで必要な設定

Posted at

OCPのbastion(踏み台)サーバーをProxy経由でのインターネット接続環境として構築した場合、目的に応じて複数個所でProxyの設定が必要です。実際にやってみたところ、設定ミスも重なり苦戦したため備忘として記録しておきます。

検証環境:

  • bastionサーバー:RHEL8
  • OCP 4.12

bastionサーバーをProxy経由でのインターネットアクセスにする場合、必要な設定は次の3項目です。
1.RHELサブスクリプション用設定 -- /etc/rhsm/rhsm.conf
2.RHELマシン自体のhttp proxy設定 -- /etc/profile.d/proxy.sh
3.OCPクラスターのProxy設定 -- install-config.yaml

以下では、Proxyサーバーが次のとおりと仮定した場合の設定例を示します。

  • IPアドレス: a.b.c.d
  • ポート番号: 80

1. RHELサブスクリプション用設定

Red Hat Subscription Manager Configuration Fileである /etc/rhsm/rhsm.conf ファイル内の次のパラメーターを設定します。このファイルはシステムにデフォルトで存在しています。該当部分を編集します。

  • proxy_hostname
  • proxy_port

/etc/rhsm/rhsm.conf 抜粋例:

proxy_hostname = a.b.c.d

proxy_port = 80

上の設定をしたうえで、subscription-manager コマンドを実行します。

# subscription-manager register

2. RHELマシン自体のhttp proxy設定

(環境変数に設定するので、当設定方法は一例です。)
このファイルはデフォルトでは存在しません。新規作成します。
/etc/profile.d/proxy.sh の例:

http_proxy="http://a.b.c.d:80/"
https_proxy="http://a.b.c.d:80/"
no_proxy="192.168.10.10,.lab.example.com,172.30.117.80,.svc"
export http_proxy https_proxy no_proxy

環境変数に反映します。

# source /etc/profile.d/proxy.sh

# env | grep proxy
http_proxy=http://a.b.c.d:80/
https_proxy=http://a.b.c.d:80/
no_proxy=192.168.10.10,.lab.example.com,172.30.117.80,.svc

3. OCPクラスターのProxy設定

新規クラスターの install-config.yaml ファイルでProxy設定を行うことにより、OpenShift Container Platform が Proxy を使用するように設定できます。

install-config.yamlファイルにProxy設定をします。

install-config.yaml 抜粋例:

apiVersion: v1
baseDomain: example.com
proxy:
  httpProxy: http://a.b.c.d:80/ 
  httpsProxy: http://a.b.c.d:80/ 
  noProxy: example.com,127.0.0.1,localhost,192.168.10.0/24
:

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1