2
2

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.

「Building an OKD4 single node cluster with minimal resources」をVirtualBoxで試してみた

Last updated at Posted at 2020-06-16

はじめに

最小構成で、OpenShift4の自宅環境が欲しいです。そんな時に天啓が聞こえました。
スクリーンショット 2020-06-16 10.21.22.png
https://twitter.com/openshiftjp/status/1267649652259774464?s=21

安易な気持ちで「CentOS+KVMでできるなら、VirtualBoxで入れ子で構築できるんじゃね?」という事で試してみましたが全くダメでした。

試した環境

  • Mac mini 2018 (Core-i5 3GHz 6Core,RAM 32GB,SSD 1TB)
  • macOS Catalina v10.15.5
  • ORACLE VM VirtualBox 6.1.8 r137981 (Qt5.6.3)
    • VM:OKD4.4SNC (RAM 26214MB,CPU 6,ネステッドVT-x/AMD-Vを有効化,ストレージ300GB固定サイズ,NICブリッジ接続)

スクリーンショット 2020-06-16 9.31.08.png

そもそもこの構成でもリソースが足りていないようです。(「最小構成」とは...)

試した結果

以下の手順内容を実施しました。
okd4-single-node-cluster (https://cgruver.github.io/okd4-single-node-cluster/)

自宅のプライベートネットワーク(192.168.1.〜)にブリッジ接続させて、192.168.1.200を割り当ててます。
「DNS Configuration」の箇所でうまくいかない感じだったので、forwardersでをルータのDNSを定義しています。

/etc/named.conf
acl "trusted" {
	192.168.1.0/24;
};

options {
	listen-on port 53 { 127.0.0.1; 192.168.1.200; };
	
	directory 	"/var/named";
	dump-file 	"/var/named/data/cache_dump.db";
	statistics-file "/var/named/data/named_stats.txt";
	memstatistics-file "/var/named/data/named_mem_stats.txt";
	allow-query     { trusted; };

	forwarders { 192.168.1.1; };
	recursion yes;

	dnssec-enable yes;
	dnssec-validation yes;

	/* Path to ISC DLV key */
	bindkeys-file "/etc/named.iscdlv.key";

	managed-keys-directory "/var/named/dynamic";

	pid-file "/run/named/named.pid";
	session-keyfile "/run/named/session.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
	type hint;
	file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
include "/etc/named/named.conf.local";

結局のところ、KVMにノードをデプロイする際のリソース確保が半端ない量だという事がわかりました。

~/bin/DeployOkdSnc.sh
      1 #!/bin/bash
      2 
      3 set -x
      4 
      5 # This script will set up the infrastructure to deploy a single node OKD 4.X cluster
      6 CPU="4"
      7 MEMORY="16384"
      8 DISK="200"
      9 FCOS_VER=31.20200505.2.0
                                : (中略)
     92 # Create the Bootstrap Node VM
     93 mkdir -p /VirtualMachines/okd4-snc-bootstrap
     94 virt-install --name okd4-snc-bootstrap --memory 14336 --vcpus 2 --disk size=100,path=/VirtualMachines/okd4-snc-b        ootstrap/rootvol,bus=sata --cdrom /tmp/bootstrap.iso --network bridge=br0 --graphics none --noautoconsole --os-v        ariant centos7.0
                                : (中略)
    120 # Create the OKD Node VM
    121 mkdir -p /VirtualMachines/okd4-snc-master
    122 virt-install --name okd4-snc-master --memory ${MEMORY} --vcpus ${CPU} --disk size=${DISK},path=/VirtualMachines/        okd4-snc-master/rootvol,bus=sata --cdrom /tmp/snc-master.iso --network bridge=br0 --graphics none --noautoconsol        e --os-variant centos7.0
    123 
    124 rm -rf /tmp/fcos

スクリプトを追ってみただけでも、

  • bootstrapノード : RAM14G,CPU2,DISK100G
  • masterノード : RAM16GB,CPU4,DISK200G

が必要なようです。
更にホストOSのリソースを足さねばならないので、私のように更に(x2)仮想マシンの入れ子で構築したい場合、メモリは64GBくらい欲しいです。
何度かスクリプト内の値を変更しましたが、masterノードがうまくデプロイできませんでした。

[6/18追記]
DeployOkdSnc.sh の virt-install コマンドで指定している --vcpus を「1」にするとデプロイが進みますが、今度はKVMのゲスト環境が、ホストOSのみしか通信ができない状態になってしまい、bootstrapノードのインストールができない状態です。
VirtualBoxのブリッジアダプタをKVMホストで更にブリッジインタフェースにしているのですが、構成の問題なのかはまだよくわかってません。調べてます!

~~というわけで、メモリ増設を検討します。~~←[6/18]増設しなくてもいけそうなので、却下します。

[8/17追記]
VirtualBoxのブリッジアダプタをWiFiにしていたからのようでした。有線LANにすると更に進みましたが、また別の要因で進めておりません。
使っているのはMacなのですが、自宅のiOS端末とAirDropをする条件で同一のWiFi接続でBluetoothを有効にしておかないと使えないという悩ましい問題があって、最初は有線LANだったのですがWiFiに切り替えていたのですよね...

またしばらく時間が取れそうにないのですが、新たに見つけた構築記事を試そうかと考えています。
https://medium.com/swlh/guide-okd-4-5-single-node-cluster-832693cb752b

ずっと悩んでいるわけにもいかないので、現在はCodeReadyを使っています...

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?