CodeReady Containers : インストール2022/02/25 |
シングルノードで RedHat OpenShift 4 クラスターを構成可能な CodeReady Containers をインストールします。
CodeReady Containers をインストールするにあたっての、ハードウェアの最小要件は以下の通りです。
* 4 CPU (vCPU)
* 9 GB of free memory * 35 GB of storage space |
|
[1] |
CodeReady Containers のセットアップは一般ユーザーで実行する仕様となっています。
ただし、セットアップ過程では当然 root 権限が必要な作業も含まれています。 よって、こちらの [1] を参考に、CodeReady Containers のセットアップを実行したい一般ユーザーに、sudo による root 権限を付与しておきます。 |
[2] |
以下の公式サイトにアクセスして CodeReady Containers インストーラー および Pull Secret
をダウンロードし、インストールしたいサーバーにアップロードしておきます。
ダウンロードするには、RedHat アカウントでのログインが必要です。
⇒ https://cloud.redhat.com/openshift/create/local
|
[3] | [1] で権限を付与したユーザーでログインして、CodeReady Containers をセットアップします。 一般ユーザーは root から su するのではなく、そのユーザー自身でログインして作業します。 root からの su では crc setup が失敗します。(環境変数等々の設定で回避可能だが、当例ではそこは説明はしません) |
[cent@dlp ~]$ total 3079628 -rw-rw-r--. 1 cent cent 3153534932 Feb 25 10:44 crc-linux-amd64.tar.xz -rw-rw-r--. 1 cent cent 2771 Feb 25 10:43 pull-secret.txt[cent@dlp ~]$ tar Jxvf crc-linux-amd64.tar.xz [cent@dlp ~]$ sudo mv ./crc-linux-1.39.0-amd64/crc /usr/local/bin/ [cent@dlp ~]$ sudo chown root. /usr/local/bin/crc [cent@dlp ~]$ sudo chmod 755 /usr/local/bin/crc [cent@dlp ~]$ crc version CodeReady Containers version: 1.39.0+ba8a8acc OpenShift version: 4.9.15 (embedded in executable) # CodeReady Containers インストールのためのシステム要件をセットアップ [cent@dlp ~]$ crc setup
CodeReady Containers is constantly improving and we would like to know more about usage (more details at https://developers.redhat.com/article/tool-data-collection)
Your preference can be changed manually if desired using 'crc config set consent-telemetry <yes/no>'
Would you like to contribute anonymous usage statistics? [y/N]: y
Thanks for helping us! You can disable telemetry with the command 'crc config set consent-telemetry no'.
INFO Checking if running as non-root
INFO Checking if running inside WSL2
INFO Checking if crc-admin-helper executable is cached
INFO Checking for obsolete admin-helper executable
INFO Checking if running on a supported CPU architecture
INFO Checking minimum RAM requirements
INFO Checking if crc executable symlink exists
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 active user/process is currently part of the 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 crc daemon systemd service
INFO Checking crc daemon systemd socket units
INFO Setting up crc daemon systemd socket units
INFO Checking if systemd-networkd is running
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 Writing Network Manager config for crc
INFO Using root access: Writing NetworkManager configuration to /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf
INFO Using root access: Changing permissions for /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf to 644
INFO Using root access: Executing systemctl daemon-reload command
INFO Using root access: Executing systemctl reload NetworkManager
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists
INFO Writing dnsmasq config for crc
INFO Using root access: Writing NetworkManager configuration to /etc/NetworkManager/dnsmasq.d/crc.conf
INFO Using root access: Changing permissions for /etc/NetworkManager/dnsmasq.d/crc.conf to 644
INFO Using root access: Executing systemctl daemon-reload command
INFO Using root access: Executing systemctl reload NetworkManager
INFO Checking if libvirt 'crc' network is available
INFO Setting up libvirt 'crc' network
INFO Checking if libvirt 'crc' network is active
INFO Starting libvirt 'crc' network
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if /home/cent/.crc/cache/crc_libvirt_4.9.15.crcbundle exists
INFO Extracting bundle from the CRC executable
INFO Ensuring directory /home/cent/.crc/cache exists
INFO Extracting embedded bundle crc_libvirt_4.9.15.crcbundle to /home/cent/.crc/cache
INFO Uncompressing crc_libvirt_4.9.15.crcbundle
Your system is correctly setup for using CodeReady Containers, you can now run 'crc start' to start the OpenShift cluster
# ダウンロードした Pull Secret を指定して CodeReady Containers セットアップ [cent@dlp ~]$ crc start -p pull-secret.txt
INFO Checking if running as non-root
INFO Checking if running inside WSL2
INFO Checking if crc-admin-helper executable is cached
INFO Checking for obsolete admin-helper executable
INFO Checking if running on a supported CPU architecture
INFO Checking minimum RAM requirements
INFO Checking if crc executable symlink exists
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 active user/process is currently part of the 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 crc daemon systemd socket units
INFO Checking if systemd-networkd is running
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
INFO Checking if libvirt 'crc' network is available
INFO Checking if libvirt 'crc' network is active
INFO Loading bundle: crc_libvirt_4.9.15...
INFO Creating CodeReady Containers VM for OpenShift 4.9.15...
INFO Generating new SSH Key pair...
INFO Generating new password for the kubeadmin user
INFO Starting CodeReady Containers VM for OpenShift 4.9.15...
INFO CodeReady Containers instance is running with IP 192.168.130.11
INFO CodeReady Containers VM is running
INFO Updating authorized keys...
INFO Check internal and public DNS query...
INFO Check DNS query from host...
INFO Verifying validity of the kubelet certificates...
INFO Starting OpenShift kubelet service
INFO Waiting for kube-apiserver availability... [takes around 2min]
INFO Adding user's pull secret to the cluster...
INFO Updating SSH key to machine config resource...
INFO Waiting for user's pull secret part of instance disk...
INFO Changing the password for the kubeadmin user
INFO Updating cluster ID...
INFO Updating root CA cert to admin-kubeconfig-client-ca configmap...
INFO Starting OpenShift cluster... [waiting for the cluster to stabilize]
INFO Operator openshift-controller-manager is progressing
INFO Operator kube-apiserver is progressing
INFO 2 operators are progressing: authentication, kube-apiserver
INFO Operator authentication is progressing
INFO Operator authentication is progressing
INFO Operator authentication is progressing
INFO All operators are available. Ensuring stability...
INFO Operators are stable (2/3)...
INFO Operators are stable (3/3)...
INFO Adding crc-admin and crc-developer contexts to kubeconfig...
Started the OpenShift cluster.
The server is accessible via web console at:
https://console-openshift-console.apps-crc.testing
Log in as administrator:
Username: kubeadmin
Password: mvA2Q-CL922-ego9R-kBwie
Log in as user:
Username: developer
Password: developer
Use the 'oc' command line interface:
$ eval $(crc oc-env)
$ oc login -u developer https://api.crc.testing:6443
# [Started the OpenShift cluster] と表示されればセットアップは正常終了
|
[4] | OpenShift Cluster にログインして動作確認しておきます。 |
[cent@dlp ~]$ eval $(crc oc-env) [cent@dlp ~]$ oc login -u kubeadmin https://api.crc.testing:6443 Logged into "https://api.crc.testing:6443" as "kubeadmin" using existing credentials. You have access to 64 projects, the list has been suppressed. You can list all projects with 'oc projects' Using project "default".[cent@dlp ~]$ oc get nodes NAME STATUS ROLES AGE VERSION crc-8rwmc-master-0 Ready master,worker 28d v1.22.3+e790d7f[cent@dlp ~]$ oc get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE openshift-apiserver-operator openshift-apiserver-operator-595488d966-tgfgs 1/1 Running 0 28d openshift-apiserver apiserver-56bdf9c9c4-jzttk 2/2 Running 0 27d openshift-authentication-operator authentication-operator-78cf46778-wpdpt 1/1 Running 0 28d openshift-authentication oauth-openshift-7dc7b6975d-8dl64 1/1 Running 0 8m17s openshift-cluster-machine-approver machine-approver-74559b5df9-6ng9c 2/2 Running 1 (13m ago) 28d ..... ..... openshift-operator-lifecycle-manager packageserver-76c948d469-xsd7f 1/1 Running 0 28d openshift-sdn sdn-controller-96fcg 1/1 Running 0 28d openshift-sdn sdn-lstzh 2/2 Running 0 28d openshift-service-ca-operator service-ca-operator-668487d9b9-sgnx2 1/1 Running 0 27d openshift-service-ca service-ca-69d4cd64c7-pk2qx 1/1 Running 0 28d[cent@dlp ~]$ oc get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.217.4.1 <none> 443/TCP 28d openshift ExternalName <none> kubernetes.default.svc.cluster.local <none> 28d[cent@dlp ~]$ oc get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pv0001 100Gi RWO,ROX,RWX Recycle Bound openshift-image-registry/crc-image-registry-storage 27d pv0002 100Gi RWO,ROX,RWX Recycle Available 27d pv0003 100Gi RWO,ROX,RWX Recycle Available 27d pv0004 100Gi RWO,ROX,RWX Recycle Available 27d pv0005 100Gi RWO,ROX,RWX Recycle Available 27d ..... ..... |
[5] | CodeReady Containers の起動/停止は以下のように実行します。 |
# 状態確認 [cent@dlp ~]$ crc status CRC VM: Running OpenShift: Running (v4.9.15) Disk Usage: 13.56GB of 32.74GB (Inside the CRC VM) Cache Usage: 15.85GB Cache Directory: /home/cent/.crc/cache # 停止 [cent@dlp ~]$ crc stop
# 起動 [cent@dlp ~]$ crc start
# CodeReady Containers は仮想マシンで動作 [cent@dlp ~]$ sudo virsh list Id Name State ---------------------- 1 crc running |
Sponsored Link |
|