OpenShift Service Mesh 3.0 is a Technology Preview feature only
Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. This documentation is a work in progress and might not be complete or fully tested.5.2. マルチクラスター設定の概要
マルチクラスタートポロジーを設定するには、次のアクションを実行する必要があります。
- 各クラスターに OpenShift Service Mesh Operator をインストールします。
- 各クラスターのルート証明書と中間証明書を作成するか、それらにアクセスできるようにします。
- 各クラスターにセキュリティー証明書を適用します。
- 各クラスターに Istio をインストールします。
5.2.1. マルチクラスタートポロジー用の証明書の作成
2 つのクラスターのルート証明書と中間認証局 (CA) 証明書を作成します。
前提条件
- OpenSSL がローカルにインストールされている。
手順
ルート CA 証明書を作成します。
次のコマンドを実行して、ルート証明書のキーを作成します。
$ openssl genrsa -out root-key.pem 4096
ルート CA 証明書用に、
root-ca.conf
という名前の OpenSSL 設定証明書ファイルを作成します。ルート証明書設定ファイルの例
encrypt_key = no prompt = no utf8 = yes default_md = sha256 default_bits = 4096 req_extensions = req_ext x509_extensions = req_ext distinguished_name = req_dn [ req_ext ] subjectKeyIdentifier = hash basicConstraints = critical, CA:true keyUsage = critical, digitalSignature, nonRepudiation, keyEncipherment, keyCertSign [ req_dn ] O = Istio CN = Root CA
次のコマンドを実行して証明書署名要求を作成します。
$ openssl req -sha256 -new -key root-key.pem \ -config root-ca.conf \ -out root-cert.csr
次のコマンドを実行して、共有ルート証明書を作成します。
$ openssl x509 -req -sha256 -days 3650 \ -signkey root-key.pem \ -extensions req_ext -extfile root-ca.conf \ -in root-cert.csr \ -out root-cert.pem
East クラスターの中間 CA 証明書を作成します。
次のコマンドを実行して、
east
という名前のディレクトリーを作成します。$ mkdir east
次のコマンドを実行して、East クラスターの中間証明書のキーを作成します。
$ openssl genrsa -out east/ca-key.pem 4096
East クラスターの中間証明書用に、
east/
ディレクトリーに、intermediate.conf
という名前の OpenSSL 設定ファイルを作成します。次のサンプルファイルをコピーしてローカルに保存します。設定ファイルのサンプル
[ req ] encrypt_key = no prompt = no utf8 = yes default_md = sha256 default_bits = 4096 req_extensions = req_ext x509_extensions = req_ext distinguished_name = req_dn [ req_ext ] subjectKeyIdentifier = hash basicConstraints = critical, CA:true, pathlen:0 keyUsage = critical, digitalSignature, nonRepudiation, keyEncipherment, keyCertSign subjectAltName=@san [ san ] DNS.1 = istiod.istio-system.svc [ req_dn ] O = Istio CN = Intermediate CA L = east
次のコマンドを実行して証明書署名要求を作成します。
$ openssl req -new -config east/intermediate.conf \ -key east/ca-key.pem \ -out east/cluster-ca.csr
次のコマンドを実行して、East クラスターの中間 CA 証明書を作成します。
$ openssl x509 -req -sha256 -days 3650 \ -CA root-cert.pem \ -CAkey root-key.pem -CAcreateserial \ -extensions req_ext -extfile east/intermediate.conf \ -in east/cluster-ca.csr \ -out east/ca-cert.pem
次のコマンドを実行して、east クラスターの中間 CA 証明書とルート CA 証明書から証明書チェーンを作成します。
$ cat east/ca-cert.pem root-cert.pem > east/cert-chain.pem && cp root-cert.pem east
West クラスターの中間 CA 証明書を作成します。
次のコマンドを実行して、
west
という名前のディレクトリーを作成します。$ mkdir west
次のコマンドを実行して、West クラスターの中間証明書のキーを作成します。
$ openssl genrsa -out west/ca-key.pem 4096
West クラスターの中間証明書用に、
west/
ディレクトリーにintermediate.conf
という名前の OpenSSL 設定ファイルを作成します。次のサンプルファイルをコピーしてローカルに保存します。設定ファイルのサンプル
[ req ] encrypt_key = no prompt = no utf8 = yes default_md = sha256 default_bits = 4096 req_extensions = req_ext x509_extensions = req_ext distinguished_name = req_dn [ req_ext ] subjectKeyIdentifier = hash basicConstraints = critical, CA:true, pathlen:0 keyUsage = critical, digitalSignature, nonRepudiation, keyEncipherment, keyCertSign subjectAltName=@san [ san ] DNS.1 = istiod.istio-system.svc [ req_dn ] O = Istio CN = Intermediate CA L = west
次のコマンドを実行して証明書署名要求を作成します。
$ openssl req -new -config west/intermediate.conf \ -key west/ca-key.pem \ -out west/cluster-ca.csr
次のコマンドを実行して証明書を作成します。
$ openssl x509 -req -sha256 -days 3650 \ -CA root-cert.pem \ -CAkey root-key.pem -CAcreateserial \ -extensions req_ext -extfile west/intermediate.conf \ -in west/cluster-ca.csr \ -out west/ca-cert.pem
次のコマンドを実行して証明書チェーンを作成します。
$ cat west/ca-cert.pem root-cert.pem > west/cert-chain.pem && cp root-cert.pem west
5.2.2. マルチクラスタートポロジーへの証明書の適用
マルチクラスタートポロジー内のクラスターにルートおよび中間認証局 (CA) 証明書を適用します。
この手順では、CLUSTER1
は East クラスター、CLUSTER2
は West クラスターです。
前提条件
- 外部ロードバランサーをサポートする 2 つの OpenShift Container Platform クラスターにアクセスできる。
- 各クラスターのルート CA 証明書と中間 CA 証明書を自分で作成したか、またはそれらが誰かによって用意されている。
手順
マルチクラスタートポロジーの East クラスターに証明書を適用します。
次のコマンドを実行して、East クラスターにログインします。
$ oc login -u https://<east_cluster_api_server_url>
次のコマンドを実行して、East クラスターの
oc
コマンドコンテキストを含む環境変数を設定します。$ export CTX_CLUSTER1=$(oc config current-context)
次のコマンドを実行して、
istio-system
というプロジェクトを作成します。$ oc get project istio-system --context "${CTX_CLUSTER1}" || oc new-project istio-system --context "${CTX_CLUSTER1}"
次のコマンドを実行して、East クラスターの Pod のデフォルトネットワークとして
network1
を使用するように Istio を設定します。$ oc --context "${CTX_CLUSTER1}" label namespace istio-system topology.istio.io/network=network1
次のコマンドを実行して、East クラスター上の Istio の CA 証明書、証明書チェーン、および秘密鍵を作成します。
$ oc get secret -n istio-system --context "${CTX_CLUSTER1}" cacerts || oc create secret generic cacerts -n istio-system --context "${CTX_CLUSTER1}" \ --from-file=east/ca-cert.pem \ --from-file=east/ca-key.pem \ --from-file=east/root-cert.pem \ --from-file=east/cert-chain.pem
注記「マルチクラスターメッシュの証明書の作成」の手順に従った場合、証明書は
east/
ディレクトリーに保存されます。証明書が別のディレクトリーに存在する場合は、それに応じて構文を変更してください。
マルチクラスタートポロジーの West クラスターに証明書を適用します。
次のコマンドを実行して、West クラスターにログインします。
$ oc login -u https://<west_cluster_api_server_url>
次のコマンドを実行して、West クラスターの
oc
コマンドコンテキストを含む環境変数をセットアップします。$ export CTX_CLUSTER2=$(oc config current-context)
次のコマンドを実行して、
istio-system
というプロジェクトを作成します。$ oc get project istio-system --context "${CTX_CLUSTER2}" || oc new-project istio-system --context "${CTX_CLUSTER2}"
次のコマンドを実行して、West クラスター上の Pod のデフォルトネットワークとして
network2
を使用するように Istio を設定します。$ oc --context "${CTX_CLUSTER2}" label namespace istio-system topology.istio.io/network=network2
次のコマンドを実行して、West クラスター上の Istio の CA 証明書シークレットを作成します。
$ oc get secret -n istio-system --context "${CTX_CLUSTER2}" cacerts || oc create secret generic cacerts -n istio-system --context "${CTX_CLUSTER2}" \ --from-file=west/ca-cert.pem \ --from-file=west/ca-key.pem \ --from-file=west/root-cert.pem \ --from-file=west/cert-chain.pem
注記「マルチクラスターメッシュの証明書の作成」の手順に従った場合、証明書は
west/
ディレクトリーに保存されます。証明書が別のディレクトリーに存在する場合は、それに応じて構文を変更します。
次のステップ
メッシュトポロジーを構成するすべてのクラスターに Istio をインストールします。