🤖

vSphere 上に OKD 4.21 をデプロイしてみた

に公開

vSphere 上に OKD 4.21 をデプロイしてみた

~ openshift-install を使った IPI(Installer-Provided Infrastructure)構築手順まとめ ~

OKD (旧称 OpenShift Origin)は、Red Hat OpenShift のコミュニティディストリビューションです。OpenShift関連の運用や検証環境としてデプロイしてみました。

この記事では、vSphere 環境に OKD を IPI(Installer Provided Infrastructure)方式でデプロイした手順を、メモがてら共有します。

公式ドキュメントは以下の通りです。
https://docs.okd.io/4.19/installing/installing_vsphere/ipi/installing-vsphere-installer-provisioned.html

1. 事前準備

1-1. openshift-install のダウンロード

※作業端末はRHELを利用しています。

OKD 用のインストーラは GitHub Releases から入手します。
https://github.com/okd-project/okd/releases

私は4.21をダウンロードしました。

wget https://github.com/okd-project/okd/releases/download/4.21.0-okd-scos.ec.7/openshift-install-linux-4.21.0-okd-scos.ec.7.tar.gz
tar -xvf openshift-install-linux-4.21.0-okd-scos.ec.7.tar.gz

1-2. インストール用ディレクトリを作成

mkdir okd
cd okd

2. openshift-install create cluster を実行

今回の IPI インストールは、以下のコマンドで開始します。

./openshift-install create cluster --dir . --log-level=info

インタラクティブに vSphere 設定や VIP、Pull Secret などを入力していきます。

3. インタラクティブ設定の流れ

インストールログの抜粋を使いながら説明します。

3-1. vSphere 接続情報

? Platform vsphere
? vCenter vcsa-01.lab.local
? Username administrator@vsphere.local
? Password ********
INFO Connecting to vCenter vcsa-01.lab.local
INFO Defaulting to only available datacenter: DC-01
INFO Defaulting to only available cluster: /DC-01/host/CL-01

ここでは vCenter の URL・ユーザ・パスワードを入力します。
Datacenter / Cluster は自動検出されます。
※ホスト名やパスワードなどは環境によって変更してください。

3-2. データストア・ネットワーク・VIP

? Default Datastore /DC-01/datastore/QNAP-DataStore
? Network DP-lab-VM
? Virtual IP Address for API 192.168.100.231
? Virtual IP Address for Ingress 192.168.100.232

API / Ingress VIP は 同じ L2 セグメントで固定 IP を使用します。
※IPアドレスは設計に従ってください。

3-3. クラスタ名・ドメイン・Pull Secret

? Base Domain lab.local
? Cluster Name okd-01
? Pull Secret *****************************************************

ドメインは、<cluster>.<base domain> 形式で展開されます。
今回はドメインをlab.local、クラスター名はokd-01にしました。

4. vSphere 上の VM 生成フェーズ

ここからは自動で、デプロイが進んでいきます。

INFO Successfully populated MCS CA cert information: root-ca 2035-11-14T12:23:13Z 2025-11-16T12:23:13Z
INFO Successfully populated MCS TLS cert information: root-ca 2035-11-14T12:23:13Z 2025-11-16T12:23:13Z
INFO Adding clusters...
I1116 21:23:16.196732   29455 session.go:227] "Created and cached vSphere client session" server="vcsa-01.lab.local" datacenter="" username="administrator@vsphere.local"
INFO Creating infrastructure resources...
INFO Importing OVA okd-01-sznfg-rhcos-generated-failure-domain into failure domain generated-failure-domain.
INFO Started local control plane with envtest
INFO Stored kubeconfig for envtest in: /home/vmware/okd/.clusterapi_output/envtest.kubeconfig
INFO Running process: Cluster API with args [-v=2 --diagnostics-address=0 --health-addr=127.0.0.1:41285 --webhook-port=39671 --webhook-cert-dir=/tmp/envtest-serving-certs-3733010640 --kubeconfig=/home/vmware/okd/.clusterapi_output/envtest.kubeconfig]
INFO Running process: vsphere infrastructure provider with args [-v=2 --diagnostics-address=0 --health-addr=127.0.0.1:37721 --webhook-port=37957 --webhook-cert-dir=/tmp/envtest-serving-certs-3939159729 --leader-elect=false --kubeconfig=/home/vmware/okd/.clusterapi_output/envtest.kubeconfig]
INFO Creating infra manifests...
INFO Created manifest *v1.Namespace, namespace= name=openshift-cluster-api-guests
INFO Created manifest *v1beta1.Cluster, namespace=openshift-cluster-api-guests name=okd-01-sznfg-0
INFO Created manifest *v1beta1.VSphereCluster, namespace=openshift-cluster-api-guests name=okd-01-sznfg-0
INFO Created manifest *v1.Secret, namespace=openshift-cluster-api-guests name=vsphere-creds-0
INFO Done creating infra manifests
INFO Creating kubeconfig entry for capi cluster okd-01-sznfg-0
INFO Waiting up to 15m0s (until 9:38PM JST) for network infrastructure to become ready...
INFO Network infrastructure is ready
INFO Created manifest *v1beta1.VSphereMachine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-bootstrap
INFO Created manifest *v1beta1.VSphereMachine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-master-0
INFO Created manifest *v1beta1.VSphereMachine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-master-1
INFO Created manifest *v1beta1.VSphereMachine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-master-2
INFO Created manifest *v1beta1.Machine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-bootstrap
INFO Created manifest *v1beta1.Machine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-master-0
INFO Created manifest *v1beta1.Machine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-master-1
INFO Created manifest *v1beta1.Machine, namespace=openshift-cluster-api-guests name=okd-01-sznfg-master-2
INFO Created manifest *v1.Secret, namespace=openshift-cluster-api-guests name=okd-01-sznfg-bootstrap
INFO Created manifest *v1.Secret, namespace=openshift-cluster-api-guests name=okd-01-sznfg-master
INFO Waiting up to 15m0s (until 9:39PM JST) for machines [okd-01-sznfg-bootstrap okd-01-sznfg-master-0 okd-01-sznfg-master-1 okd-01-sznfg-master-2] to provision...
INFO Control-plane machines are ready
INFO Cluster API resources have been created. Waiting for cluster to become ready...
INFO Waiting up to 20m0s (until 9:55PM JST) for the Kubernetes API at https://api.okd-01.lab.local:6443...
INFO API v1.34.1-dirty up
INFO Waiting up to 1h0m0s (until 10:35PM JST) for bootstrapping to complete...
INFO Waiting for the bootstrap etcd member to be removed...
INFO Bootstrap etcd member has been removed
INFO Destroying the bootstrap resources...
INFO Waiting up to 5m0s for bootstrap machine deletion openshift-cluster-api-guests/okd-01-sznfg-bootstrap...
INFO Shutting down local Cluster API controllers...
INFO Stopped controller: Cluster API
INFO Stopped controller: vsphere infrastructure provider
INFO Shutting down local Cluster API control plane...
INFO Local Cluster API system has completed operations
INFO no post-destroy requirements for the vsphere provider
INFO Finished destroying bootstrap resources
INFO Waiting up to 40m0s (until 10:46PM JST) for the cluster at https://api.okd-01.lab.local:6443 to initialize...
INFO Waiting up to 30m0s (until 11:05PM JST) to ensure each cluster operator has finished progressing...
INFO All cluster operators have completed progressing
INFO Checking to see if there is a route at openshift-console/console...
INFO Install complete!
INFO To access the cluster as the system:admin user when using 'oc', run
INFO     export KUBECONFIG=/home/vmware/okd/auth/kubeconfig
INFO Access the OpenShift web-console here: https://console-openshift-console.apps.okd-01.lab.local
INFO Login to the console with user: "kubeadmin", and password: "xxxxxxxxxxxxxxxxxx"
INFO Time elapsed: 1h14m48s

自動生成される VM:
Bootstrap 1台
コントロールプレーン 3台
ワーカーノード 3台

所要時間:
約 1時間15分

5. 確認

デプロイが成功している場合は、以下の画像のような仮想マシンがデプロイされていると思います。

6. ログイン確認

初期のユーザ名はkubeadmin、パスワードはログに記載されています。
もしくは作業ディレクトリのパスワードを確認します。

cat auth/kubeadmin-password


7. 最後に

今後は定期的にOKDを利用した検証を記事にして行く予定です!

Discussion