14.3. エージェントベースのインストーラーを使用した OpenShift Container Platform クラスターのインストール

14.3.1. 前提条件

14.3.2. エージェントベースのインストーラーを使用した OpenShift Container Platform のインストール

以下の手順では、切断された環境で単一ノードの OpenShift Container Platform をデプロイします。この手順はベースとして使用し、要件に応じて変更できます。

手順

  1. ログイン認証情報を使用して OpenShift Container Platform Web コンソールにログインします。
  2. データセンター に移動します。

    エージェントインストール
  3. Run Agent-based Installer locally をクリックします。Install OpenShift Container Platform on Bare Metal locally with Agent ページに移動します。
  4. オプション: または、Select an OpenShift Container Platform cluster type to create ページで Bare Metal (x86_64) をクリックすることもできます。Create an OpenShift Container Platform Cluster: Bare Metal ページに移動します。次に、Local Agent-based を選択して Install OpenShift Container Platform on Bare Metal Local with Agent ページに移動します。

    エージェントインストール (ベアメタル)
  5. オペレーティングシステムとアーキテクチャーを選択します。
  6. Download Installer をクリックして、インストールプログラムをダウンロードして展開します。
  7. Download pull secret または Copy pull secret をクリックして、プルシークレットをダウンロードまたはコピーできます。
  8. Download command-line tools をクリックし、openshift-install バイナリーを PATH 上のディレクトリーに配置します。
  9. 以下のコマンドを実行して nmstate の依存関係をインストールします。

    $ sudo dnf install /usr/bin/nmstatectl -y
  10. PATH にあるディレクトリーに openshift-install バイナリーを配置します。
  11. 次のコマンドを実行して、インストール設定を保存するディレクトリーを作成します。

    $ mkdir ~/<directory_name>
    注記

    これは、エージェントベースのインストールで推奨される方法です。ZTP マニフェストの使用はオプションです。

  12. install-config.yaml ファイルを作成します。

    $ cat << EOF > ./my-cluster/install-config.yaml
    apiVersion: v1
    baseDomain: test.example.com
    compute:
    - architecture: amd64
      hyperthreading: Enabled
      name: worker
      replicas: 0
    controlPlane:
      architecture: amd64
      hyperthreading: Enabled
      name: master
      replicas: 1
    metadata:
      name: sno-cluster 1
    networking:
      clusterNetwork:
      - cidr: 10.128.0.0/14
        hostPrefix: 23
      machineNetwork:
      - cidr: 192.168.111.0/16
      networkType: OVNKubernetes 2
      serviceNetwork:
      - 172.30.0.0/16
    platform:
      none: {}
    pullSecret: '<pull_secret>' 3
    sshKey: |
      <ssh_pub_key> 4
      EOF
    1
    必須。
    2
    インストールするクラスターネットワークプラグイン。サポートされている値は OVNKubernetesOpenShiftSDN です。デフォルトの値は OVNkubernetes です。
    3
    プルシークレットを入力します。
    4
    ssh 公開鍵を入力します。
    注記

    プラットフォームを vSphere または baremetal に設定すると、クラスターノードの IP アドレスエンドポイントを次の 3 つの方法で設定できます。

    • IPv4
    • IPv6
    • IPv4 と IPv6 の並列 (デュアルスタック)

    デュアルスタックネットワーキングの例

    networking:
      clusterNetwork:
        - cidr: 172.21.0.0/16
          hostPrefix: 23
        - cidr: fd02::/48
          hostPrefix: 64
      machineNetwork:
        - cidr: 192.168.11.0/16
        - cidr: 2001:DB8::/32
      serviceNetwork:
        - 172.22.0.0/16
        - fd03::/112
      networkType: OVNKubernetes
    platform:
      baremetal:
        apiVIPs:
        - 192.168.11.3
        - 2001:DB8::4
        ingressVIPs:
        - 192.168.11.4
        - 2001:DB8::5

    IPv6 は、ベアメタルプラットフォームでのみサポートされます。

  13. agent-config.yaml ファイルを作成します。

    $ cat > agent-config.yaml << EOF
    apiVersion: v1alpha1
    kind: AgentConfig
    metadata:
      name: sno-cluster
    rendezvousIP: 192.168.111.80 1
    hosts: 2
      - hostname: master-0 3
        interfaces:
          - name: eno1
            macAddress: 00:ef:44:21:e6:a5
        rootDeviceHints: 4
          deviceName: /dev/sdb
        networkConfig: 5
          interfaces:
            - name: eno1
              type: ethernet
              state: up
              mac-address: 00:ef:44:21:e6:a5
              ipv4:
                enabled: true
                address:
                  - ip: 192.168.111.80
                    prefix-length: 23
                dhcp: false
          dns-resolver:
            config:
              server:
                - 192.168.111.1
          routes:
            config:
              - destination: 0.0.0.0/0
                next-hop-address: 192.168.111.2
                next-hop-interface: eno1
                table-id: 254
      EOF
    1
    この IP アドレスは、ブートストラッププロセスを実行するノードや、assisted-service コンポーネントを実行するノードを判別するために使用されます。networkConfig パラメーターで少なくとも 1 つのホストの IP アドレスを指定しない場合は、ランデブー IP アドレスを指定する必要があります。このアドレスが指定されていない場合、指定されたホストの networkConfig から 1 つの IP アドレスが選択されます。
    2
    ホスト設定はオプションです。定義されたホストの数は、install-config.yaml ファイルで定義されたホストの総数 (compute.replicas および controlPlane.replicas パラメーターの値の合計) を超えてはなりません。
    3
    オプションの hostname パラメーターは、動的ホスト設定プロトコル (DHCP) または逆引き DNS ルックアップから取得したホスト名をオーバーライドします。各ホストには、これらの方法のいずれかによって提供される一意のホスト名が必要です。
    4
    rootDeviceHints パラメーターは、Red Hat Enterprise Linux CoreOS (RHCOS) イメージを特定のデバイスにプロビジョニングできるようにします。これは、検出順にデバイスを検査し、検出された値をヒントの値と比較します。ヒントの値と一致する最初に検出されたデバイスが使用されます。
    5
    ホストのネットワークインターフェイスを NMState 形式で設定するには、このオプションパラメーターを設定します。
  14. 以下のコマンドを実行して agent イメージを作成します。

    $ openshift-install --dir <install_directory> agent create image
    注記

    Red Hat Enterprise Linux CoreOS (RHCOS) はプライマリーディスクでのマルチパスをサポートするようになり、ハードウェア障害に対する対障害性が強化され、ホストの可用性を強化できるようになりました。マルチパス化は、デフォルトの /etc/multipath.conf 設定を使用して、agent.iSO イメージでデフォルトで有効になっています。

  15. ベアメタルマシンで agent.x86_64.iso イメージを起動します。
  16. オプション: ブートストラップホスト (ランデブーホスト) がいつ再起動するかを知るには、次のコマンドを実行します。

    $ ./openshift-install --dir <install_directory> agent wait-for bootstrap-complete \ 1
        --log-level=info 2
    1
    <install_directory> には、エージェント ISO が生成されたディレクトリーへのパスを指定します。
    2
    異なるインストールの詳細情報を表示するには、info ではなく、warndebug、または error を指定します。

    出力例

    ...................................................................
    ...................................................................
    INFO Bootstrap configMap status is complete
    INFO cluster bootstrap is complete

    Kubernetes API サーバーでこれがコントロールプレーンマシンにブートストラップされていることを示すシグナルが出されるとコマンドは成功します。

  17. 進捗状況を追跡し、正常なインストールを確認するには、以下のコマンドを実行します。

    $ openshift-install --dir <install_directory> agent wait-for install-complete 1
    1
    <install_directory> directory には、エージェント ISO が生成されたディレクトリーへのパスを指定します。

    出力例

    ...................................................................
    ...................................................................
    INFO Cluster is installed
    INFO Install complete!
    INFO To access the cluster as the system:admin user when using 'oc', run
    INFO     export KUBECONFIG=/home/core/installer/auth/kubeconfig
    INFO Access the OpenShift web-console here: https://console-openshift-console.apps.sno-cluster.test.example.com

注記

ZTP マニフェストのオプションの方法を使用している場合、次の 3 つの方法で AgentClusterInstall.yaml ファイルを介してクラスターノードの IP アドレスエンドポイントを設定できます。

  • IPv4
  • IPv6
  • IPv4 と IPv6 の並列 (デュアルスタック)

デュアルスタックネットワーキングの例

apiVIP: 192.168.11.3
ingressVIP: 192.168.11.4
clusterDeploymentRef:
  name: mycluster
imageSetRef:
  name: openshift-4.12
networking:
  clusterNetwork:
  - cidr: 172.21.0.0/16
    hostPrefix: 23
  - cidr: fd02::/48
    hostPrefix: 64
  machineNetwork:
  - cidr: 192.168.11.0/16
  - cidr: 2001:DB8::/32
  serviceNetwork:
  - 172.22.0.0/16
  - fd03::/112
  networkType: OVNKubernetes

IPv6 は、ベアメタルプラットフォームでのみサポートされます。

関連情報

14.3.3. 失敗したエージェントベースのインストールからログデータを収集する

次の手順を使用して、失敗したエージェントベースのインストールに関するログデータを収集し、サポートケースで提供できるよう備えます。

手順

  1. 次のコマンドを実行し、出力を収集します。

    $ ./openshift-install --dir <install_directory> agent wait-for bootstrap-complete --log-level=debug

    エラーメッセージの例

    ...
    ERROR Bootstrap failed to complete: : bootstrap process timed out: context deadline exceeded

  2. 前のコマンドの出力が失敗を示している場合、またはブートストラップが進まない場合は、ノード 0 で次のコマンドを実行し、出力を収集します。

    $ ssh core@<node-ip> sudo /usr/local/bin/agent-gather -O > <local_tmp_path>/agent-gather.tar.xz
    注記

    データを収集する必要があるのはノード 0 だけですが、すべてのノードからこのデータを収集すると役立ちます。

  3. ブートストラップが完了し、クラスターノードが再起動したら、次のコマンドを実行して出力を収集します。

    $ ./openshift-install --dir <install_directory> agent wait-for install-complete --log-level=debug
  4. 前のコマンドの出力が失敗を示している場合は、次の手順を実行します。

    1. 次のコマンドを実行して、kubeconfig ファイルを環境にエクスポートします。

      $ export KUBECONFIG=<install_directory>/auth/kubeconfig
    2. デバッグ用の情報を収集するには、次のコマンドを実行します。

      $ oc adm must-gather
    3. 次のコマンドを実行して、作業ディレクトリーに作成した must-gather ディレクトリーから圧縮ファイルを作成します。

      $ tar cvaf must-gather.tar.gz <must_gather_directory>
  5. /auth サブディレクトリーを除き、デプロイメント中に使用したインストールディレクトリーを Red Hat カスタマーポータル のサポートケースに添付します。
  6. この手順で収集した他のすべてのデータをサポートケースに添付してください。

14.3.4. ZTP カスタムリソースの例

オプション: ゼロタッチプロビジョニング (ZTP) カスタムリソース (CR) オブジェクトを使用して、エージェントベースのインストーラーで OpenShift Container Platform クラスターをインストールできます。

以下の ZTP カスタムリソースをカスタマイズして、OpenShift Container Platform クラスターの詳細を指定できます。以下は、単一ノードクラスターの ZTP カスタムリソースの例です。

agent-cluster-install.yaml

  apiVersion: extensions.hive.openshift.io/v1beta1
  kind: AgentClusterInstall
  metadata:
    name: test-agent-cluster-install
    namespace: cluster0
  spec:
    clusterDeploymentRef:
      name: ostest
    imageSetRef:
      name: openshift-4.12
    networking:
      clusterNetwork:
      - cidr: 10.128.0.0/14
        hostPrefix: 23
      serviceNetwork:
      - 172.30.0.0/16
    provisionRequirements:
      controlPlaneAgents: 1
      workerAgents: 0
    sshPublicKey: <YOUR_SSH_PUBLIC_KEY>

cluster-deployment.yaml

apiVersion: hive.openshift.io/v1
kind: ClusterDeployment
metadata:
  name: ostest
  namespace: cluster0
spec:
  baseDomain: test.metalkube.org
  clusterInstallRef:
    group: extensions.hive.openshift.io
    kind: AgentClusterInstall
    name: test-agent-cluster-install
    version: v1beta1
  clusterName: ostest
  controlPlaneConfig:
    servingCertificates: {}
  platform:
    agentBareMetal:
      agentSelector:
        matchLabels:
          bla: aaa
  pullSecretRef:
    name: pull-secret

cluster-image-set.yaml

apiVersion: hive.openshift.io/v1
kind: ClusterImageSet
metadata:
  name: openshift-4.12
spec:
  releaseImage: registry.ci.openshift.org/ocp/release:4.12.0-0.nightly-2022-06-06-025509

infra-env.yaml

apiVersion: agent-install.openshift.io/v1beta1
kind: InfraEnv
metadata:
  name: myinfraenv
  namespace: cluster0
spec:
  clusterRef:
    name: ostest
    namespace: cluster0
  pullSecretRef:
    name: pull-secret
  sshAuthorizedKey: <YOUR_SSH_PUBLIC_KEY>
  nmStateConfigLabelSelector:
    matchLabels:
      cluster0-nmstate-label-name: cluster0-nmstate-label-value

nmstateconfig.yaml

apiVersion: agent-install.openshift.io/v1beta1
kind: NMStateConfig
metadata:
  name: master-0
  namespace: openshift-machine-api
  labels:
    cluster0-nmstate-label-name: cluster0-nmstate-label-value
spec:
  config:
    interfaces:
      - name: eth0
        type: ethernet
        state: up
        mac-address: 52:54:01:aa:aa:a1
        ipv4:
          enabled: true
          address:
            - ip: 192.168.122.2
              prefix-length: 23
          dhcp: false
    dns-resolver:
      config:
        server:
          - 192.168.122.1
    routes:
      config:
        - destination: 0.0.0.0/0
          next-hop-address: 192.168.122.1
          next-hop-interface: eth0
          table-id: 254
  interfaces:
    - name: "eth0"
      macAddress: 52:54:01:aa:aa:a1

pull-secret.yaml

apiVersion: v1
kind: Secret
type: kubernetes.io/dockerconfigjson
metadata:
  name: pull-secret
  namespace: cluster0
stringData:
  .dockerconfigjson: 'YOUR_PULL_SECRET'

関連情報