12.3. Agent-based Installer を使用した OpenShift Container Platform クラスターのインストール
12.3.1. 前提条件
- OpenShift Container Platform のインストールおよび更新 プロセスの詳細を確認した。
- クラスターインストール方法の選択およびそのユーザー向けの準備 を確認した。
- ファイアウォールまたプロキシーを使用する場合は、クラスターがアクセスを必要とするサイトを許可するようにファイアウォールを設定する必要がある。
12.3.2. Agent-based Installer を使用した OpenShift Container Platform のインストール
以下の手順では、切断された環境で単一ノードの OpenShift Container Platform をデプロイします。この手順はベースとして使用し、要件に応じて変更できます。
手順
- ログイン認証情報を使用して OpenShift Container Platform Web コンソールにログインします。
データセンター に移動します。
- Run Agent-based Installer locally をクリックします。Install OpenShift Container Platform on Bare Metal locally with Agent ページに移動します。
オプション: または、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 ページに移動します。
- オペレーティングシステムとアーキテクチャーを選択します。
- Download Installer をクリックして、インストールプログラムをダウンロードして展開します。
- Download pull secret または Copy pull secret をクリックして、プルシークレットをダウンロードまたはコピーできます。
-
Download command-line tools をクリックし、
openshift-install
バイナリーをPATH
上のディレクトリーに配置します。 以下のコマンドを実行して
nmstate
の依存関係をインストールします。$ sudo dnf install /usr/bin/nmstatectl -y
-
PATH にあるディレクトリーに
openshift-install
バイナリーを配置します。 次のコマンドを実行して、インストール設定を保存するディレクトリーを作成します。
$ mkdir ~/<directory_name>
注記これは、エージェントベースのインストールで推奨される方法です。ZTP マニフェストの使用はオプションです。
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
注記プラットフォームを
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 は、ベアメタルプラットフォームでのみサポートされます。
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 形式で設定するには、このオプションパラメーターを設定します。
以下のコマンドを実行して agent イメージを作成します。
$ openshift-install --dir <install_directory> agent create image
注記Red Hat Enterprise Linux CoreOS (RHCOS) はプライマリーディスクでのマルチパスをサポートするようになり、ハードウェア障害に対する対障害性が強化され、ホストの可用性を強化できるようになりました。マルチパス化は、デフォルトの
/etc/multipath.conf
設定を使用して、agent.iSO イメージでデフォルトで有効になっています。-
ベアメタルマシンで
agent.x86_64.iso
イメージを起動します。 オプション: ブートストラップホスト (ランデブーホスト) がいつ再起動するかを知るには、次のコマンドを実行します。
$ ./openshift-install --dir <install_directory> agent wait-for bootstrap-complete \ 1 --log-level=info 2
出力例
................................................................... ................................................................... INFO Bootstrap configMap status is complete INFO cluster bootstrap is complete
Kubernetes API サーバーでこれがコントロールプレーンマシンにブートストラップされていることを示すシグナルが出されるとコマンドは成功します。
進捗状況を追跡し、正常なインストールを確認するには、以下のコマンドを実行します。
$ 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 は、ベアメタルプラットフォームでのみサポートされます。
関連情報
- デュアルスタックネットワークを使用したデプロイメント を参照してください。
- install-config yaml ファイルの設定 を参照してください。
- ベアメタル環境に 3 ノードクラスターをデプロイするための 3 ノードクラスターの設定 を参照してください。
- ルートデバイスヒントについて を参照してください。
- NMState 状態の例 を参照してください。
12.3.3. 失敗したエージェントベースのインストールからログデータを収集する
次の手順を使用して、失敗したエージェントベースのインストールに関するログデータを収集し、サポートケースで提供できるよう備えます。
手順
次のコマンドを実行し、出力を収集します。
$ ./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
前のコマンドの出力が失敗を示している場合、またはブートストラップが進まない場合は、ノード 0 で次のコマンドを実行し、出力を収集します。
$ ssh core@<node-ip> sudo /usr/local/bin/agent-gather -O > <local_tmp_path>/agent-gather.tar.xz
注記データを収集する必要があるのはノード 0 だけですが、すべてのノードからこのデータを収集すると役立ちます。
ブートストラップが完了し、クラスターノードが再起動したら、次のコマンドを実行して出力を収集します。
$ ./openshift-install --dir <install_directory> agent wait-for install-complete --log-level=debug
前のコマンドの出力が失敗を示している場合は、次の手順を実行します。
次のコマンドを実行して、
kubeconfig
ファイルを環境にエクスポートします。$ export KUBECONFIG=<install_directory>/auth/kubeconfig
デバッグ用の情報を収集するには、次のコマンドを実行します。
$ oc adm must-gather
次のコマンドを実行して、作業ディレクトリーに作成した
must-gather
ディレクトリーから圧縮ファイルを作成します。$ tar cvaf must-gather.tar.gz <must_gather_directory>
-
/auth
サブディレクトリーを除き、デプロイメント中に使用したインストールディレクトリーを Red Hat カスタマーポータル のサポートケースに添付します。 - この手順で収集した他のすべてのデータをサポートケースに添付してください。
12.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'
関連情報
- ゼロタッチプロビジョニング (ZTP) の詳細は、ネットワーク遠端の課題 を参照してください。