Slide 1

Slide 1 text

OpenShift the Easy Way からの Hard? Way ちょいと早い忘年会 OpenShift.Run Winter 2020 #11 @loftkun

Slide 2

Slide 2 text

whoami • @loftkun • 日本アイ・ビー・エム • CNDF2020実行委員 • Contribute : Minikube • Red Hat OpenShift Administration ラーニング受講中

Slide 3

Slide 3 text

Agenda • 構築方法 • Red Hat CodeReady Containers ( CRC ) • UPI install on bare metal

Slide 4

Slide 4 text

構築方法

Slide 5

Slide 5 text

Environments https://cloud.redhat.com/openshift/install

Slide 6

Slide 6 text

おうちOpenShift the Hard? Way the Easy Way https://cloud.redhat.com/openshift/install

Slide 7

Slide 7 text

the Easy Way

Slide 8

Slide 8 text

Red Hat CodeReady Containers ( CRC ) https://cloud.redhat.com/openshift/install

Slide 9

Slide 9 text

About CRC • minimalなOpenShift 4 クラスタを ローカルマシン上に構築できる • Windows 10 Pro ( 1709+ ) • macOS ( 10.12+ ) • RHEL/CentOS 7.5+, Fefora ( , Ubuntu 18.04LTS, Debian 10 )

Slide 10

Slide 10 text

CRC vs Minikube コマンド CRC Minikube 初期化 setup なし クラスター起動 start 同左 クラスター停止 stop 同左 クラスター削除 delete 同左 WebUI表示 console dashboard • コマンド体系は類似している https://access.redhat.com/documentation/en-us/red_hat_codeready_containers/1.20/html/getting_started_guide/introducing-codeready-containers_gsg

Slide 11

Slide 11 text

Spec https://access.redhat.com/documentation/en-us/red_hat_codeready_containers/1.20/html/getting_started_guide/installation_gsg#minimum-system-requirements_gsg Requirements ( v1.20 ) my bare metal vCPU 4 12 ( core i7-8700K) RAM [GB] 9 64 Storage [GB] 35 512 • 今回は、ベアメタル上のRHEL8.0にCRCを導入して OpenShiftクラスタを構築してみました

Slide 12

Slide 12 text

• リソースや仮想化機能などのチェックが入る • メモリ容量とディスク容量は足りないと怒られる • オーバーコミット的には起動できなそうなので、要件を 満たすマシンが必要なようだ setup $ crc setup INFO Checking if oc binary is cached INFO Checking if podman remote binary is cached INFO Checking if goodhosts binary is cached INFO Checking if CRC bundle is cached in '$HOME/.crc' INFO Checking minimum RAM requirements INFO Checking if running as non-root INFO Checking if Virtualization is enabled INFO Checking if KVM is enabled INFO Checking if libvirt is installed INFO Checking if user is part of libvirt group INFO Checking if libvirt daemon is running INFO Checking if a supported libvirt version is installed INFO Checking if crc-driver-libvirt is installed INFO Checking for obsolete crc-driver-libvirt INFO Checking if libvirt 'crc' network is available INFO Checking if libvirt 'crc' network is active INFO Checking if NetworkManager is installed INFO Checking if NetworkManager service is running INFO Checking if /etc/NetworkManager/conf.d/crc-nm- dnsmasq.conf exists INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists Setup is complete, you can now run 'crc start' to start the OpenShift cluster $

Slide 13

Slide 13 text

• libvirtdを起動するように怒られた • 起動するとstartに成功した • ocコマンドによるアクセスが可能となる • crc oc-env • oc login • WebUIをブラウザで開ける • crc console start $ crc start ( 略 ) WARN No active (running) libvirtd systemd unit could be found - make sure one of libvirt systemd units is enabled so that it's autostarted at boot time. found no active libvirtd systemd unit $ $ sudo systemctl start libvirtd $ $ crc start ( 略 ) Started the OpenShift cluster To access the cluster, first set up your environment by following 'crc oc-env' instructions. Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'. To login as an admin, run 'oc login -u kubeadmin -p hxYtC-KLeQC-kfNkm-ppi8i https://api.crc.testing:6443'. You can now run 'crc console' and use these credentials to access the OpenShift web console. $

Slide 14

Slide 14 text

WebUI $ crc console • From Git • ソースコードのリポジトリからデプロイ • Container Image, From Dockerfile, YAML • From Catalog • Databases、Operator Backed、Helm Chart

Slide 15

Slide 15 text

Quick Starts • Quick Start ( チュートリアル )もついている • CRCは、わずか数回のコマンド実行で OpenShiftを使い始められるようになっている [loft@rhel8 ~]$ oc login -u kubeadmin -p ********** https://api.crc.testing:6443 Login successful. You have access to 59 projects, the list has been suppressed. You can list all projects with ' projects' Using project "default". [loft@rhel8 ~]$ oc get po NAME READY STATUS RESTARTS AGE nodejs-sample-1-build 0/1 Completed 0 15m nodejs-sample-8578969d46-qhkzp 1/1 Running 0 14m [loft@rhel8 ~]$

Slide 16

Slide 16 text

the Hard? Way

Slide 17

Slide 17 text

UPI install on bare metal the Hard? Way • 今回は UPI install on bare metal を選択 • IPI install on bare metal は 4.6 で新規追加されているようです https://cloud.redhat.com/openshift/install/metal

Slide 18

Slide 18 text

Requirements ( v4.6 ) https://docs.openshift.com/container-platform/4.6/installing/installing_bare_metal/installing-bare-metal.html#minimum-resource-requirements_installing-bare-metal ノード OS vCPU RAM [GB] STORAGE [GB] 台数 ブートストラップ RHCOS 4 16 120 1 コントロール RHCOS 4 16 120 3 コンピュート RHCOS 2 8 120 2 合計 - 20 80 720 6

Slide 19

Slide 19 text

検証環境 https://access.redhat.com/documentation/ja-jp/openshift_container_platform/4.6/html/installing_on_bare_metal/installing-on-bare-metal#prerequisites ノード OS vCPU RAM [GB] STORAGE [GB] 台数 ブートストラップ RHCOS 4 16 120 1 コントロール RHCOS 4 16 120 3 コンピュート RHCOS 2 8 120 2 踏み台サーバー RHEL8.0 2 4 50 1 合計 - 22 84 770 7 My bare metal ESXi 12 64 2000 1 追加 DNS/DHCP/Loa dBalancer用 オーバーコミット core i7-8700K ( 6core/12thread ) / RAM 64GB / HDD 2TB

Slide 20

Slide 20 text

Goal

Slide 21

Slide 21 text

1. Prepare bare metal and ESXi

Slide 22

Slide 22 text

2. Prepare bastion VM

Slide 23

Slide 23 text

3. Prepare node VMs

Slide 24

Slide 24 text

4. Prepare DHCP, DNS, LoadBalancer, etc 参考: OpenShift 4.1をベアメタルへUPIインストールする - 赤帽エンジニアブログ https://rheb.hatenablog.com/entry/openshift41-baremetal-upi DNSサーバ : クラスタのドメイン 名解決 DHCPサーバ : IPアドレスを各ノー ドに付与 LoadBalancer : APIへのアクセス を各コントロール ノードに分散 Webサーバ : 各ノードがブート時 に設定ファイルを GET

Slide 25

Slide 25 text

# coreos-installer install # ./openshift-install wait-for bootstrap-complete ( : 30分くらい待つ ) Bootstrap status: complete 5. Bootstarp cluster

Slide 26

Slide 26 text

リソース負荷 • 今回はオーバーコミットしていることもあり • アイドル状態でもCPU60%以上で推移 • 搭載実メモリはほぼ使用されている

Slide 27

Slide 27 text

注意事項 • VM間の時刻ずれがないよう注意 • ESXiホストのNTP設定をしてなく、数日放置しておいたら、 踏み台VMと(ブートストラップ前の)ノードVMとの間に 数日の時刻差が生じていた • 気づかずにそのままクラスタのブートストラップを進めると、証明書の検証で怒られた • ESXiを使う場合はESXiホストにNTPの設定して時刻がずれないようにし よう

Slide 28

Slide 28 text

まとめ Red Hat CodeReady Containers ( CRC ) • わずか数コマンドでOpenShiftクラスタを構築したいあなたにおすすめ UPI install on bare metal • 手数と時間はかかるが、本格的なマルチノード構成のおうちOpenShiftを自 分の手で構築したい自作派のあなたにおすすめ • 実行コマンドなどの詳細はkubernetesアドベントカレンダー2020に投稿予 定です。 • 4.6でのインストール手順の変更点など記載予定です。

Slide 29

Slide 29 text

EOP ご清聴ありがとうございました。