14.4. Kubernetes Operator のマルチクラスターエンジン用の Agent ベースのインストール済みクラスターの準備

Kubernetes Operator 用のマルチクラスターエンジンをインストールし、エージェントベースの OpenShift Container Platform インストーラーを使用してハブクラスターをデプロイできます。次の手順は部分的に自動化されており、最初のクラスターがデプロイメントされた後に手動の手順が必要です。

14.4.1. 前提条件

14.4.2. 切断中の Kubernetes Operator のマルチクラスターエンジン用のエージェントベースのクラスターデプロイの準備

切断された環境で、必要な OpenShift Container Platform コンテナーイメージ、Kubernetes Operator のマルチクラスターエンジン、および Local Storage Operator (LSO) をローカルミラーレジストリーにミラーリングできます。ミラーレジストリーのローカル DNS ホスト名とポートを必ず書き留めておいてください。

注記

OpenShift Container Platform イメージリポジトリーをミラーレジストリーにミラーリングするには、oc adm release image または oc mirror コマンドを使用できます。この手順では、oc mirror コマンドを例として使用します。

手順

  1. <assets_directory> フォルダーを作成して、有効な install-config.yaml および agent-config.yaml ファイルを含めます。このディレクトリーは、すべてのアセットを格納するために使用されます。
  2. 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.12 4
              type: ocp
        additionalImages:
          - name: registry.redhat.io/ubi8/ubi:latest
        operators:
          - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12 5
            packages: 6
              - name: multicluster-engine 7
              - name: local-storage-operator 8

    1
    イメージセット内の各ファイルの最大サイズを GiB 単位で指定します。
    2
    イメージセットのメタデータを受け取るバックエンドの場所を設定します。この場所は、レジストリーまたはローカルディレクトリーにすることができます。Technology Preview OCI 機能を使用していない場合は、storageConfig 値を指定する必要があります。
    3
    ストレージバックエンドのレジストリー URL を設定します。
    4
    インストールするバージョンの OpenShift Container Platform イメージを含むチャネルを設定します。
    5
    インストールする OpenShift Container Platform イメージを含む Operator カタログを設定します。
    6
    イメージセットに含める特定の Operator パッケージとチャネルのみを指定します。カタログ内のすべてのパッケージを取得するには、このフィールドを削除してください。
    7
    マルチクラスターエンジンのパッケージとチャネル。
    8
    LSO パッケージとチャネル。
    注記

    このファイルは、コンテンツをミラーリングするときに oc mirror コマンドで必要になります。

  3. 特定の OpenShift Container Platform イメージリポジトリー、マルチクラスターエンジン、および LSO をミラーリングするには、以下のコマンドを実行します。

    $ oc mirror --dest-skip-tls --config ocp-mce-imageset.yaml docker://<your-local-registry-dns-name>:<your-local-registry-port>
  4. 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/ubi8"
          mirrors:
            - "<your-local-registry-dns-name>:<your-local-registry-port>/ubi8"
        - 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.yamladditionalTrustBundle フィールドに存在することを確認してください。

    install-config.yaml の例

    additionalTrustBundle: |
      -----BEGIN CERTIFICATE-----
      zzzzzzzzzzz
      -----END CERTIFICATE-------

    重要

    oc mirror コマンドは、いくつかの出力を含む oc-mirror-workspace というフォルダーを作成します。これには、OpenShift Container Platform および選択した Operator に必要なすべてのミラーを識別する imageContentSourcePolicy.yaml ファイルが含まれます。

  5. 次のコマンドを実行して、クラスターマニフェストを生成します。

    $ openshift-install agent create cluster-manifests

    このコマンドは、クラスターマニフェストフォルダーを更新して、ミラー設定を含むmirror フォルダーを含めます。

14.4.3. 接続中の Kubernetes Operator のマルチクラスターエンジン用のエージェントベースのクラスターデプロイメントの準備

Kubernetes Operator のマルチクラスターエンジンである Local Storage Operator (LSO) に必要なマニフェストを作成し、エージェントベースの OpenShift Container Platform クラスターをハブクラスターとしてデプロイします。

手順

  1. <assets_directory> フォルダーに openshift という名前のサブフォルダーを作成します。このサブフォルダーは、デプロイされたクラスターをさらにカスタマイズするためにインストール中に適用される追加のマニフェストを格納するために使用されます。<assets_directory> フォルダーには、install-config.yaml および agent-config.yaml ファイルを含むすべてのアセットが含まれています。

    注記

    インストーラーは、追加のマニフェストを検証しません。

  2. マルチクラスターエンジンの場合、以下のマニフェストを作成し、それらを <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.1"
        name: multicluster-engine
        source: redhat-operators
        sourceNamespace: openshift-marketplace

    注記

    アシステッドインストーラー(AI) を使用して、Red Hat Advanced Cluster Management (RHACM) で分散ユニット (DU) を大規模にインストールできます。これらの分散ユニットは、ハブクラスターで有効にする必要があります。AI サービスには、手動で作成される永続ボリューム (PV) が必要です。

  3. 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

  4. 次のコマンドを実行して、エージェント ISO イメージを作成します。

    $ openshift-install agent create image --dir <assets_directory>
  5. イメージの準備ができたら、ターゲットマシンを起動し、インストールが完了するまで待ちます。
  6. インストールを監視するには、次のコマンドを実行します。

    $ openshift-install agent wait-for install-complete --dir <assets_directory>
    注記

    完全に機能するハブクラスターを設定するには、次のマニフェストを作成し、コマンド $ oc apply -f <manifest-name> を実行して手動で適用する必要があります。マニフェストの作成順序は重要であり、必要に応じて待機状態が表示されます。

  7. 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
  8. 後続のマニフェストを適用する前に、次のコマンドを使用して 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.
  9. マルチクラスターエンジンインスタンスのマニフェストを作成します。

    Example MultiClusterEngine.yaml

      apiVersion: multicluster.openshift.io/v1
      kind: MultiClusterEngine
      metadata:
        name: multiclusterengine
      spec: {}

  10. マニフェストを作成して 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

  11. 後続のスポーククラスターをデプロイするためのマニフェストを作成します。

    clusterimageset.yaml

      apiVersion: hive.openshift.io/v1
      kind: ClusterImageSet
      metadata:
        name: "4.12"
      spec:
        releaseImage: quay.io/openshift-release-dev/ocp-release:4.12.0-x86_64

  12. マニフェストを作成して、エージェントがインストールされたクラスター (マルチクラスターエンジンと 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

  13. マネージドクラスターが作成されるまで待ちます。

    $ 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