zaki work log

作業ログやら生活ログやらなんやら

CodeReady Containers 1.2.0がVirtualBoxでデプロイできなくなったので1.1.0のcrcで無理やり動かしてみる(未成功)

12/4追記: 成功編含めてv1.2.0時点でのHyper-V/VirtualBoxでの動作状況をまとめました

qiita.com

バージョン

v1.2.0だとHyper-V用の処理が強制実行されてエラーになるため、v1.1.0のcrcを使用する。

PS C:\Users\zaki> crc version
crc version: 1.1.0+95966a9
OpenShift version: 4.2.2 (embedded in binary)
PS C:\Users\zaki>

crc setup

ここは普通に。

PS C:\Users\zaki> crc setup --vm-driver virtualbox --log-level debug
INFO Checking if running as normal user
INFO Caching oc binary
DEBU oc binary is not cached
DEBU Downloading oc
DEBU Downloading https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/windows/oc.zip to C:\Users\zaki\AppData\Local\Temp\crc338011499
DEBU Download saved to C:\Users\zaki\AppData\Local\Temp\crc338011499\oc.zip
DEBU Uncompressing C:\Users\zaki\AppData\Local\Temp\crc338011499\oc.zip to C:\Users\zaki\AppData\Local\Temp\crc338011499
DEBU Copying 'C:\Users\zaki\AppData\Local\Temp\crc338011499\oc.exe' to 'C:\Users\zaki\.crc\bin\oc.exe'
DEBU oc binary cached
INFO Unpacking bundle from the CRC binary
DEBU CreateFile C:\Users\zaki\.crc\crc_hyperv_4.2.2.crcbundle: The system cannot find the file specified.
Setup is complete, you can now run 'crc start' to start the OpenShift cluster
PS C:\Users\zaki>

crc start

使用するcrcbundleファイルは1.2.0のものを使用する。(1.1.0は証明書期限切れになるため) ただし、crcがv1.1.0で1.2.0用crcbundleの4.2.8を認識しないため、crc_virtualbox_4.2.8.crcbundle を crc_virtualbox_4.2.2.crcbundle にリネームする。

そしてcrc start実行

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\archives\crc\1.2.0\crc_virtualbox_4.2.2.crcbundle --pull-secret-file .\archives\crc\pull-secret.txt
WARN A new version (1.2.0) has been published on https://cloud.redhat.com/openshift/install/crc/installer-provisioned
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Extracting bundle: crc_virtualbox_4.2.2.crcbundle ...
ERRO Error getting bundle metadata: Could not find cached bundle info
PS C:\Users\zaki>

エラーになる。 というのも、ファイルの実体が4.2.8なcrcbundleを展開すると、パスも4.2.8になるため。

PS C:\Users\zaki> ls .\.crc\cache\


    ディレクトリ: C:\Users\zaki\.crc\cache


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019/12/03      7:34                crc_virtualbox_4.2.8


PS C:\Users\zaki>

このディレクトリ名もリネームする

PS C:\Users\zaki> mv .\.crc\cache\crc_virtualbox_4.2.8\ .\.crc\cache\crc_virtualbox_4.2.2
PS C:\Users\zaki>
PS C:\Users\zaki> ls .\.crc\cache\


    ディレクトリ: C:\Users\zaki\.crc\cache


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019/12/03      7:34                crc_virtualbox_4.2.2


PS C:\Users\zaki>

再実行

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\archives\crc\1.2.0\crc_virtualbox_4.2.2.crcbundle --pull-secret-file .\archives\crc\pull-secret.txt
WARN A new version (1.2.0) has been published on https://cloud.redhat.com/openshift/install/crc/installer-provisioned
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Loading bundle: crc_virtualbox_4.2.2.crcbundle ...
INFO Creating CodeReady Containers VM for OpenShift 4.2.8...
INFO Verifying validity of the cluster certificates ...
Please follow instructions in the documentation about setting hostnames for Virtualbox.

この辺まで来たらssh秘密鍵を入れ替える。

  • mv .\.crc\cache\crc_virtualbox_4.2.2\id_rsa_crc .\.crc\cache\crc_virtualbox_4.2.2\id_rsa_crc.bak
  • cp .\.crc\machines\crc\id_rsa .\.crc\cache\crc_virtualbox_4.2.2\id_rsa_crc

そして別ターミナルでcrc ipしてIPアドレスを確認。

PS C:\Users\zaki> crc ip
192.168.130.103

表示されたアドレスでOSのDNS設定を変更する。

f:id:zaki-hmkc:20191203080241p:plain

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\archives\crc\1.2.0\crc_virtualbox_4.2.2.crcbundle --pull-secret-file .\archives\crc\pull-secret.txt
WARN A new version (1.2.0) has been published on https://cloud.redhat.com/openshift/install/crc/installer-provisioned
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Loading bundle: crc_virtualbox_4.2.2.crcbundle ...
INFO Creating CodeReady Containers VM for OpenShift 4.2.8...
INFO Verifying validity of the cluster certificates ...
Please follow instructions in the documentation about setting hostnames for Virtualbox.
INFO Check internal and public DNS query ...
INFO Copying kubeconfig file to instance dir ...
INFO Adding user's pull secret and cluster ID ...
INFO Starting OpenShift cluster ... [waiting 3m]
INFO
INFO To access the cluster, first set up your environment by following 'crc oc-env' instructions
INFO Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'
INFO To login as an admin, username is 'kubeadmin' and password is ****-****-****-****
INFO
INFO You can now run 'crc console' and use these credentials to access the OpenShift web console
ERRO Error approving the node csr Not able to get csr names (exit status 1 : Unable to connect to the server: dial tcp: lookup api.crc.testing: no such host
)
PS C:\Users\zaki>

あら、、うまくいきそうでいかなかった。 Hyper-Vと違って外部からの名前解決要求には応えないみたい。

DNS設定でなくhosts設定ならうまくいきそうなのでやり直してみよう。