11.5. Kubernetes Operator のマルチクラスターエンジン用の Agent ベースのインストール済みクラスターの準備
マルチクラスターエンジン Operator をインストールし、エージェントベースの OpenShift Container Platform インストーラーを使用してハブクラスターをデプロイできます。次の手順は部分的に自動化されており、最初のクラスターがデプロイメントされた後に手動の手順が必要です。
11.5.1. 前提条件
次のドキュメントを読んでいる。
- 必要なコンテナーイメージを取得するためのインターネットへのアクセスがある。
-
OpenShift CLI (
oc
) がインストールされている。 - 切断された環境にインストールする場合は、切断されたインストールのミラーリング用に設定されたローカルミラーレジストリーが必要です。
11.5.2. 切断中の Kubernetes Operator のマルチクラスターエンジン用のエージェントベースのクラスターデプロイの準備
切断された環境で、必要な OpenShift Container Platform コンテナーイメージ、マルチクラスターエンジン Operator、および Local Storage Operator (LSO) をローカルミラーレジストリーにミラーリングできます。ミラーレジストリーのローカル DNS ホスト名とポートを必ず書き留めておいてください。
OpenShift Container Platform イメージリポジトリーをミラーレジストリーにミラーリングするには、oc adm release image
または oc mirror
コマンドを使用できます。この手順では、oc mirror
コマンドを例として使用します。
手順
-
<assets_directory>
フォルダーを作成して、有効なinstall-config.yaml
およびagent-config.yaml
ファイルを含めます。このディレクトリーは、すべてのアセットを格納するために使用されます。 OpenShift Container Platform イメージリポジトリー、マルチクラスターエンジン、および LSO をミラーリングするには、以下の設定で
ImageSetConfiguration.yaml
ファイルを作成します。ImageSetConfiguration.yaml
の例kind: ImageSetConfiguration apiVersion: mirror.openshift.io/v1alpha2 archiveSize: 4 1 storageConfig: 2 imageURL: <your-local-registry-dns-name>:<your-local-registry-port>/mirror/oc-mirror-metadata 3 skipTLS: true mirror: platform: architectures: - "amd64" channels: - name: stable-4.16 4 type: ocp additionalImages: - name: registry.redhat.io/ubi9/ubi:latest operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.16 5 packages: 6 - name: multicluster-engine 7 - name: local-storage-operator 8
- 1
- イメージセット内の各ファイルの最大サイズを GiB 単位で指定します。
- 2
- イメージセットのメタデータを受け取るバックエンドの場所を設定します。この場所は、レジストリーまたはローカルディレクトリーにすることができます。
storageConfig
値を指定する必要があります。 - 3
- ストレージバックエンドのレジストリー URL を設定します。
- 4
- インストールするバージョンの OpenShift Container Platform イメージを含むチャネルを設定します。
- 5
- インストールする OpenShift Container Platform イメージを含む Operator カタログを設定します。
- 6
- イメージセットに含める特定の Operator パッケージとチャネルのみを指定します。カタログ内のすべてのパッケージを取得するには、このフィールドを削除してください。
- 7
- マルチクラスターエンジンのパッケージとチャネル。
- 8
- LSO パッケージとチャネル。
注記このファイルは、コンテンツをミラーリングするときに
oc mirror
コマンドで必要になります。特定の OpenShift Container Platform イメージリポジトリー、マルチクラスターエンジン、および LSO をミラーリングするには、以下のコマンドを実行します。
$ oc mirror --dest-skip-tls --config ocp-mce-imageset.yaml docker://<your-local-registry-dns-name>:<your-local-registry-port>
install-config.yaml
ファイルのレジストリーと証明書を更新します。Example
imageContentSources.yaml
imageContentSources: - source: "quay.io/openshift-release-dev/ocp-release" mirrors: - "<your-local-registry-dns-name>:<your-local-registry-port>/openshift/release-images" - source: "quay.io/openshift-release-dev/ocp-v4.0-art-dev" mirrors: - "<your-local-registry-dns-name>:<your-local-registry-port>/openshift/release" - source: "registry.redhat.io/ubi9" mirrors: - "<your-local-registry-dns-name>:<your-local-registry-port>/ubi9" - source: "registry.redhat.io/multicluster-engine" mirrors: - "<your-local-registry-dns-name>:<your-local-registry-port>/multicluster-engine" - source: "registry.redhat.io/rhel8" mirrors: - "<your-local-registry-dns-name>:<your-local-registry-port>/rhel8" - source: "registry.redhat.io/redhat" mirrors: - "<your-local-registry-dns-name>:<your-local-registry-port>/redhat"
さらに、証明書が
install-config.yaml
のadditionalTrustBundle
フィールドに存在することを確認してください。install-config.yaml
の例additionalTrustBundle: | -----BEGIN CERTIFICATE----- zzzzzzzzzzz -----END CERTIFICATE-------
重要oc mirror
コマンドは、いくつかの出力を含むoc-mirror-workspace
というフォルダーを作成します。これには、OpenShift Container Platform および選択した Operator に必要なすべてのミラーを識別するimageContentSourcePolicy.yaml
ファイルが含まれます。次のコマンドを実行して、クラスターマニフェストを生成します。
$ openshift-install agent create cluster-manifests
このコマンドは、クラスターマニフェストフォルダーを更新して、ミラー設定を含む
mirror
フォルダーを含めます。
11.5.3. 接続中の Kubernetes Operator のマルチクラスターエンジン用のエージェントベースのクラスターデプロイメントの準備
マルチクラスターエンジン Operator である Local Storage Operator (LSO) に必要なマニフェストを作成し、エージェントベースの OpenShift Container Platform クラスターをハブクラスターとしてデプロイします。
手順
<assets_directory>
フォルダーにopenshift
という名前のサブフォルダーを作成します。このサブフォルダーは、デプロイされたクラスターをさらにカスタマイズするためにインストール中に適用される追加のマニフェストを格納するために使用されます。<assets_directory>
フォルダーには、install-config.yaml
およびagent-config.yaml
ファイルを含むすべてのアセットが含まれています。注記インストーラーは、追加のマニフェストを検証しません。
マルチクラスターエンジンの場合、以下のマニフェストを作成し、それらを
<assets_directory>/openshift
フォルダーに保存します。例
mce_namespace.yaml
apiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" name: multicluster-engine
例
mce_operatorgroup.yaml
apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: multicluster-engine-operatorgroup namespace: multicluster-engine spec: targetNamespaces: - multicluster-engine
例
mce_subscription.yaml
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: multicluster-engine namespace: multicluster-engine spec: channel: "stable-2.3" name: multicluster-engine source: redhat-operators sourceNamespace: openshift-marketplace
注記Assisted Installer (AI) を使用して、Red Hat Advanced Cluster Management (RHACM) で分散ユニット (DU) を大規模にインストールできます。これらの分散ユニットは、ハブクラスターで有効にする必要があります。AI サービスには、手動で作成される永続ボリューム (PV) が必要です。
AI サービスの場合、以下のマニフェストを作成し、それらを
<assets_directory>/openshift
フォルダーに保存します。Example
lso_namespace.yaml
apiVersion: v1 kind: Namespace metadata: annotations: openshift.io/cluster-monitoring: "true" name: openshift-local-storage
Example
lso_operatorgroup.yaml
apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: local-operator-group namespace: openshift-local-storage spec: targetNamespaces: - openshift-local-storage
Example
lso_subscription.yaml
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: local-storage-operator namespace: openshift-local-storage spec: installPlanApproval: Automatic name: local-storage-operator source: redhat-operators sourceNamespace: openshift-marketplace
注記すべてのマニフェストを作成した後、ファイルシステムは次のように表示される必要があります。
例: ファイルシステム
<assets_directory> ├─ install-config.yaml ├─ agent-config.yaml └─ /openshift ├─ mce_namespace.yaml ├─ mce_operatorgroup.yaml ├─ mce_subscription.yaml ├─ lso_namespace.yaml ├─ lso_operatorgroup.yaml └─ lso_subscription.yaml
次のコマンドを実行して、エージェント ISO イメージを作成します。
$ openshift-install agent create image --dir <assets_directory>
- イメージの準備ができたら、ターゲットマシンを起動し、インストールが完了するまで待ちます。
インストールを監視するには、次のコマンドを実行します。
$ openshift-install agent wait-for install-complete --dir <assets_directory>
注記完全に機能するハブクラスターを設定するには、次のマニフェストを作成し、コマンド
$ oc apply -f <manifest-name>
を実行して手動で適用する必要があります。マニフェストの作成順序は重要であり、必要に応じて待機状態が表示されます。AI サービスに必要な PV については、次のマニフェストを作成します。
apiVersion: local.storage.openshift.io/v1 kind: LocalVolume metadata: name: assisted-service namespace: openshift-local-storage spec: logLevel: Normal managementState: Managed storageClassDevices: - devicePaths: - /dev/vda - /dev/vdb storageClassName: assisted-service volumeMode: Filesystem
後続のマニフェストを適用する前に、次のコマンドを使用して PV が使用可能になるまで待機します。
$ oc wait localvolume -n openshift-local-storage assisted-service --for condition=Available --timeout 10m
注記The `devicePath` is an example and may vary depending on the actual hardware configuration used.
マルチクラスターエンジンインスタンスのマニフェストを作成します。
Example
MultiClusterEngine.yaml
apiVersion: multicluster.openshift.io/v1 kind: MultiClusterEngine metadata: name: multiclusterengine spec: {}
マニフェストを作成して AI サービスを有効にします。
例
agentserviceconfig.yaml
apiVersion: agent-install.openshift.io/v1beta1 kind: AgentServiceConfig metadata: name: agent namespace: assisted-installer spec: databaseStorage: storageClassName: assisted-service accessModes: - ReadWriteOnce resources: requests: storage: 10Gi filesystemStorage: storageClassName: assisted-service accessModes: - ReadWriteOnce resources: requests: storage: 10Gi
後続のスポーククラスターをデプロイするためのマニフェストを作成します。
例
clusterimageset.yaml
apiVersion: hive.openshift.io/v1 kind: ClusterImageSet metadata: name: "4.16" spec: releaseImage: quay.io/openshift-release-dev/ocp-release:4.16.0-x86_64
マニフェストを作成して、エージェントがインストールされたクラスター (マルチクラスターエンジンと Assisted Service をホストするクラスター) をハブクラスターとしてインポートします。
例
autoimport.yaml
apiVersion: cluster.open-cluster-management.io/v1 kind: ManagedCluster metadata: labels: local-cluster: "true" cloud: auto-detect vendor: auto-detect name: local-cluster spec: hubAcceptsClient: true
マネージドクラスターが作成されるまで待ちます。
$ oc wait -n multicluster-engine managedclusters local-cluster --for condition=ManagedClusterJoined=True --timeout 10m
検証
マネージドクラスターのインストールが成功したことを確認するには、次のコマンドを実行します。
$ oc get managedcluster NAME HUB ACCEPTED MANAGED CLUSTER URLS JOINED AVAILABLE AGE local-cluster true https://<your cluster url>:6443 True True 77m
関連情報