Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OpenShift from Easy way to Hard ? Way

loftkun
December 10, 2020

OpenShift from Easy way to Hard ? Way

ちょいと早い忘年会 OpenShift.Run Winter 2020 #11
https://openshift.connpass.com/event/191402/

loftkun

December 10, 2020
Tweet

More Decks by loftkun

Other Decks in Technology

Transcript

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

    View Slide

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

    View Slide

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

    View Slide

  4. 構築方法

    View Slide

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

    View Slide

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

    View Slide

  7. the Easy Way

    View Slide

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

    View Slide

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

    View Slide

  10. 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

    View Slide

  11. 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クラスタを構築してみました

    View Slide

  12. • リソースや仮想化機能などのチェックが入る
    • メモリ容量とディスク容量は足りないと怒られる
    • オーバーコミット的には起動できなそうなので、要件を
    満たすマシンが必要なようだ
    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
    $

    View Slide

  13. • 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.
    $

    View Slide

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

    View Slide

  15. Quick Starts
    • Quick Start ( チュートリアル )もついている
    • CRCは、わずか数回のコマンド実行で
    OpenShiftを使い始められるようになっている
    [[email protected] ~]$ 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".
    [[email protected] ~]$ 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
    [[email protected] ~]$

    View Slide

  16. the Hard? Way

    View Slide

  17. 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

    View Slide

  18. 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

    View Slide

  19. 検証環境
    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

    View Slide

  20. Goal

    View Slide

  21. 1. Prepare bare metal and ESXi

    View Slide

  22. 2. Prepare bastion VM

    View Slide

  23. 3. Prepare node VMs

    View Slide

  24. 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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide