1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Linux on Power(ppc64le)でOpenShift SNC(Single Node Cluster) を試す

Posted at

本記事ではIBM Powerサーバー上でのLinux、Linux on Power上にてOpenShift SNC(Single Node Cluster)を試してみた時の手順を紹介します。
Red Hat OpenShiftはLaptopでお手軽に試すためのCodeReady Containers(CRC)が提供されていますが、Linux on Powerのイメージ提供はないためその素となるSNC(Single Node Cluster) scriptを使ってCRCと同等の環境を作ります。
基本下記手順にはLinux on Power固有の部分はないので、CRCをカスタムしたいなどといった場合のLinux on Power以外の構築も同様の手順が使用できると思います。

確認環境

  • IBM Power S822L
  • Red Hat Enterprise Linux 8.4

事前準備

環境は基本以下のSNCスクリプトを実行するだけなんですが事前準備がいくつかあります。
https://github.com/code-ready/snc

SNCは基本KVM上で動かすため、上記リンクにも記載があるように以下のlibvirt関連の設定を行っておきます。
https://github.com/openshift/installer/blob/master/docs/dev/libvirt/README.md#one-time-setup

今回は以下の設定を行いました。

KVMが有効になっているかの確認

# ls -l /dev/kvm
crw-rw-rw-+ 1 root kvm 10, 232 Oct 31 09:22 /dev/kvm

Libvirtのインストールおよびlibvirtdのstart

# dnf install libvirt-devel libvirt-daemon-kvm libvirt-client
# systemctl enable --now libvirtd

ip forwardingの確認

# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

libvirtdのTCP connectionの有効化1:TCP socketの開始

# systemctl start libvirtd-tcp.socket
# systemctl enable libvirtd-tcp.socket

libvirtdのTCP connectionの有効化2:/etc/libvirt/libvirtd.confを編集して以下の項目を追加

auth_tcp = "none"

libvirdのTCP connectionの有効化3:libvirtdの再起動

# systemctl restart libvirtd

firewall設定

# firewall-cmd --add-rich-rule "rule service name="libvirt" reject"
# firewall-cmd --zone=libvirt --add-service=libvirt

DNS関連はSNCスクリプトがNetworkManagerのDNS overlay設定をしてくれるので特に必要なさそうです。

SNCスクリプトの実行

まずgithubからスクリプトを取得します。今回は4.9のブランチを使用しました。

# git clone https://github.com/code-ready/snc.git
# cd snc
# git checkout 4.9

下記よりpull secretを取得して、環境変数に設定
https://console.redhat.com/openshift/create/local

# export OPENSHIFT_PULL_SECRET_PATH=(download path)/pull_secret.json

その他環境変数の設定。今回は安定バージョン/VMの名前/各種リソース(CPU:16コア メモリ:32G DISK:50G)の指定を行いました。

# export OPENSHIFT_VERSION=4.9.19
# export CRC_VM_NAME=snc
# export SNC_CLUSTER_MEMORY=32768
# export SNC_CLUSTER_CPUS=16
# export CRC_VM_DISK_SIZE=53687091200

SNCスクリプトでは最後にpull secretをクリアしているのですが、今回はSNCスクリプトを流した環境でそのまま使用し続けることを想定してクリアしないようにスクリプトを修正します。実際には以下の行をコメントアウトします。

mc_before_removing_pullsecret=$(retry ${OC} get mc --sort-by=.metadata.creationTimestamp --no-headers -oname)
# Replace pull secret with a null json string '{}'
retry ${OC} replace -f pull-secret.yaml
mc_after_removing_pullsecret=$(retry ${OC} get mc --sort-by=.metadata.creationTimestamp --no-headers -oname)

while [ "${mc_before_removing_pullsecret}" == "${mc_after_removing_pullsecret}" ]; do
	echo "Machine config is still not rendered"
	mc_after_removing_pullsecret=$(retry ${OC} get mc --sort-by=.metadata.creationTimestamp --no-headers -oname)
done

wait_till_cluster_stable openshift-marketplace

Proxy環境を使用している場合はHTTP_PROXY/HTTPS_PROXY/NO_PROXYの環境変数設定をするとともに、install-config.yamlの最後に以下の項目を追加します。

proxy:
  httpProxy:
  httpsProxy:
  noProxy:

SNCスクリプトを実行します。adminの初期パスワードが表示されたりするので出力はログ保存しておきます。

# ./snc.sh 2>&1 | tee snc.log

SNCスクリプトの状態チェック

SNCのgithubのreadmeにもあるようにSNCスクリプトは実行に時間がかかるので
必要に応じて進捗の状態チェックを行います。

# export KUBECONFIG=<directory_to_cloned_repo>/crc-tmp-install-data/auth/kubeconfig
# <directory_to_cloned_repo>/openshift-clients/linux/oc get pods -A

SNCスクリプト終了後の作業

SNCスクリプト終了後はPC等からremote accessできるようにCRC等同様haproxy設定を行います。
以下を参照してCRCと同様の設定を行います。
https://access.redhat.com/documentation/en-us/red_hat_codeready_containers/1.40/html/getting_started_guide/networking_gsg#setting-up-remote-server_gsg
selinux disabled / firewalld offの場合の設定手順は以下となります。

haproxyのインストールおよび構成ファイルのバックアップ

# dnf install haproxy
# cp /etc/haproxy/haproxy.cfg{,.bak}

構成ファイルの新規作成 (192.168.126.11はSNCのデフォルトアドレス)

# tee /etc/haproxy/haproxy.cfg &>/dev/null <<EOF
global
    log /dev/log local0

defaults
    balance roundrobin
    log global
    maxconn 100
    mode tcp
    timeout connect 5s
    timeout client 500s
    timeout server 500s

listen apps
    bind 0.0.0.0:80
    server crcvm 192.168.126.11:80 check

listen apps_ssl
    bind 0.0.0.0:443
    server crcvm 192.168.126.11:443 check

listen api
    bind 0.0.0.0:6443
    server crcvm 192.168.126.11:6443 check
EOF

haproxyの起動

# systemctl start haproxy

また、SNCの起動/停止はCRCと異なりスクリプトは用意されていないため、
virsh start/stop (VM名)により起動/停止を行います。
VM名はvirsh list --allで確認でき、snc-xxxxx-master-0という名前となっています。

トラブルシューティング

SNCのgithubにもあるように、問題判別のために各VMにログインしたい、といった場合は以下のエントリを
~/.ssh/configに追加してssh master/ssh bootstrapを実行してsshログインにて問題の確認を
行うことが可能です。

Host master
    Hostname 192.168.126.11
    User core
    IdentityFile <directory_to_cloned_repo>/id_ecdsa_crc
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

Host bootstrap
    Hostname 192.168.126.10
    User core
    IdentityFile <directory_to_cloned_repo>/id_ecdsa_crc
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?