Last active
June 25, 2020 14:05
-
-
Save tnk4on/ad1b816c07d20860da2ec0de82801dd2 to your computer and use it in GitHub Desktop.
OCP4.5 RC2 UPI Install for Baremetal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ocp4_upi_install.sh | |
### 前提条件 ### | |
## 参考ブログ記事: https://rheb.hatenablog.com/entry/openshift41-baremetal-upi | |
# 踏み台サーバーの構築 | |
# SSHキーペア作成 | |
# インストーラーバイナリ、インストールイメージの入手 | |
# インストール設定ファイルの作成 | |
# ------------------------------------------------------ # | |
### 1. インストール事前作業 ### | |
## 踏み台サーバーへSSH接続 | |
# テスト環境なのでrootで直接ログイン | |
ssh-add -K ~/.ssh/id_rsa | |
ssh -A root@192.168.1.21 | |
## RHCOSイメージ確認 | |
ls -l /usr/share/nginx/html/ocp/rhcos/images/latest | |
## イメージバージョン切り替え | |
# 4.5.0_rc1 → 4.5.0_rc2 | |
cd /usr/share/nginx/html/ocp/rhcos/images/latest | |
mv bios.raw.gz initramfs.img installer-kernel 4.5.0/ | |
mv 45.82/* . | |
ls -l | |
cd /root/OCP | |
rm -rf openshift-install | |
ln -s src/4.5/openshift-install-4.5.0_rc2 openshift-install | |
ls -l openshift-install | |
## openshift-installバージョン確認 | |
./openshift-install version | |
## 仮想マシン準備 | |
# PowerCliコンテナ起動 | |
docker run --rm -it vmware/powerclicore | |
# ESXi接続 | |
Connect-VIServer -Server 192.168.1.101 -Force:$true | |
Get-VM -name master*,Bootstrap | |
# スナップショットをデフォルトへ切り戻し | |
$VMs = Get-VM -name master*,Bootstrap,worker* | |
foreach($vm in $VMs){ | |
set-vm -vm $vm -Snapshot default -Confirm:$false -RunAsync | |
} | |
# ------------------------------------------------------ # | |
### 2. ignitionファイルの作成 ### | |
# インストールディレクトリの作成 | |
cd /root/OCP | |
rm -rf bare-metal | |
mkdir bare-metal | |
cp install-config.yaml bare-metal | |
# ignitionファイルの作成 | |
./openshift-install --dir=bare-metal create ignition-configs | |
# gnitionファイルを上書きコピー。対話モードをオフ。 | |
\cp -f bare-metal/*ign ignitions/ | |
ls -l ignitions/ | |
### 3. 仮想マシンの起動 ### | |
# 仮想マシンの起動(Bootstrap、Masterのみ。3ノード用) | |
Get-VM -name master*,Bootstrap | Start-vm | |
### 4. Bootstrapの確認 ### | |
# Bootstrap処理確認 | |
./openshift-install --dir=bare-metal wait-for bootstrap-complete --log-level=debug | |
# Debug: Bootstrapノードへのログイン | |
# vi .ssh/known_hosts | |
ssh core@bootstrap | |
journalctl -b -f -u bootkube.service | |
### 5. クラスターの起動確認 ### | |
# kubeconfigのexport | |
export KUBECONFIG=/root/OCP/bare-metal/auth/kubeconfig | |
# クラスターの各種確認 | |
oc whoami | |
oc get nodes | |
oc get csr | |
oc get clusteroperators | |
# Cluster Operatorの起動監視 | |
watch oc get clusteroperators | |
# クラスターインストール確認 | |
./openshift-install --dir=bare-metal wait-for install-complete --log-level=debug | |
# ------------------------------------------------------ # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
このコードは、下記の動画の中で使用しています。
https://youtu.be/zguCVicsyxU