zaki work log

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

CodeReady Containers 1.0.0をwin 10 homeのVirtualBoxで動かしたときの作業ログ

12/02追記: 現在1.0.0も最新の1.2.0もVirtualBoxへはインストールできなくなっています。 詳しくはOpenShift Advent Calendar 2019 の4日目の記事に向けてまとめ中です

12/04追記: Qiitaにv1.2.0時点での情報をまとめました。

qiita.com


CodeReady Containers 1.0.0リリース! github.com

CentOSに入れたときに--vm-driverオプションもあってvirtualboxを指定できそうだったのでWindows 10 homeでも動くのかな?と思ってたので試してみた。

結論から言うと動く。
ただ、DNS設定を手動で行う(hosts編集)必要があったり、ちょっと面倒。
ほぼ試行錯誤した際の作業ログ状態なので、きれいに手順化したいけど、とりあえず備忘録的に。

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

CentOSに入れる場合はこちらも参照。

zaki-hmkc.hatenablog.com zaki-hmkc.hatenablog.com

インストール

インストール手順はこちら

win/mac/linux、それぞれのインストーラがあるのでwin版をダウンロードする。

mirror.openshift.com

2019.10.26時点で、1.0.0が(タイムスタンプ見る限り10/22に)リリースされてる。 以下二つダウンロードする。

win 10 proでHyper-V使う場合は、crc_virtualbox_4.2.0.crcbundleは不要

crc実行ファイルの配置

crc-windows-amd64.zip

展開すると実行ファイル・ライセンス・ドキュメントが出てくるので、PATHの通ったところに配置。 手元の環境ではC:\local\crc-windows-1.0.0-amd64\crc.exeとなるようにした。

PS C:\Users\zaki> crc version
crc version: 1.0.0+575079b
OpenShift version: 4.2.0 (embedded in binary)
PS C:\Users\zaki> crc help
CodeReady Containers is a tool that manages a local OpenShift 4.x cluster optimized for testing and development purposes

Usage:
  crc [flags]
  crc [command]

Available Commands:
  config      Modify crc configuration
  console     Open the OpenShift Web Console in the default browser
  delete      Delete the OpenShift cluster
  help        Help about any command
  ip          Get IP address of the running OpenShift cluster
  oc-env      Add the 'oc' binary to PATH
  setup       Set up prerequisites for the OpenShift cluster
  start       Start the OpenShift cluster
  status      Display status of the OpenShift cluster
  stop        Stop the OpenShift cluster
  version     Print version information

Flags:
  -f, --force              Forcefully perform an action
  -h, --help               help for crc
      --log-level string   log level (e.g. "debug | info | warn | error") (default "info")

Use "crc [command] --help" for more information about a command.
PS C:\Users\zaki>

おぉ、バージョンrcがなくなってる。

rc版と同じく、versionhelpを叩くと、ホームディレクトリ以下に.crcディレクトリができている。

PS C:\Users\zaki> ls .crc


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


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       2019/10/26      9:38              2 crc.json
-a----       2019/10/26      9:38              0 crc.log


PS C:\Users\zaki>

setup

※ win10 proなら↓でも良いはず。home(VirtualBox)の場合は--vm-driverを付ける(後述)

PS C:\Users\zaki> crc setup
INFO Checking if running as normal user
INFO Caching oc binary
INFO Unpacking bundle from the CRC binary
INFO Check Windows 10 release
INFO Hyper-V installed
ERRO Hyper-V not installed
INFO Will run as admin: enable Hyper-V
ERRO Please reboot your system
INFO Is user a member of the Hyper-V Administrators group
ERRO User is not a member of the Hyper-V administrators group
ERRO Unable to get group name
FATA Unable to get group name
PS C:\Users\zaki>

Hyper-Vを(あえて)何も設定せずに実行したらやっぱり引っかかった。 更にcrc setupHyper-Vを有効してくれた。(UACの確認ダイアログが表示された)

なのでおとなしくrebootする。

なんだけど、rebootしても状態変わらず。

※ ちなみにこの時点で

PS C:\Users\zaki> ls .crc


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


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019/10/26      9:41                bin
-a----       2019/10/26      9:38              2 crc.json
-a----       2019/10/26      9:49           5907 crc.log
-a----       2019/10/26      9:41     2029934728 crc_hyperv_4.2.0.crcbundle


PS C:\Users\zaki>

というわけで、助けて。

PS C:\Users\zaki> crc setup --help
Set up local virtualization and networking infrastructure for the OpenShift cluster

Usage:
  crc setup [flags]

Flags:
  -h, --help               help for setup
  -d, --vm-driver string   The driver to use for the OpenShift cluster. Possible values: [hyperv virtualbox] (default "hyperv")

Global Flags:
  -f, --force              Forcefully perform an action
      --log-level string   log level (e.g. "debug | info | warn | error") (default "info")

なるほど。ここで--vm-driverあった。

PS C:\Users\zaki> crc setup --vm-driver virtualbox
INFO Checking if running as normal user
INFO Caching oc binary
INFO Unpacking bundle from the CRC binary
Setup is complete, you can now run 'crc start' to start the OpenShift cluster
PS C:\Users\zaki>

あっさりチェック完了した。(というか、特に何もしてないような速度で完了)

start

startでCodeReadyを動作するためのVMが起動(初回はVM作成)する。
Extracting bundle:はそこそこ時間がかかる。気長にまちましょう。

pull-secret-fileは、指定がなければ入力プロンプトが表示されるので張り付けてもいいが、事前にファイルダウンロードしておいて引数で指定する方が楽かも。
secretファイルはRed Hatのサイトから取得する(要開発者アカウント)

cloud.redhat.com

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Extracting bundle: crc_virtualbox_4.2.0.crcbundle ...
INFO Creating CodeReady Containers VM for OpenShift 4.2.0...
ERRO Error creating host: Error creating the VM: Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
PS C:\Users\zaki>

あら、、、ホストオンリーアダプタの作成で失敗してる… バージョンも5.0.12より新しいし、問題ないはずなんだけどな。。

ちなみにこの時点で、VirtualBoxVMマネージャを見ると、crcというVMが作成済み(ネットワークの設定がNAT一つの)になっている。(画面キャプチャ忘れ)

というわけで、なんとなく再実行

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Starting CodeReady Containers VM for OpenShift 4.2.0...
ERRO Failed to connect to the CRC VM with SSH
PS C:\Users\zaki>

VMの起動はうまくいった。 ネットワーク設定もホストオンリーアダプタの作成に成功してる。 (minikube, minishiftも入れてるせいで、インタフェースの数が…w) というか、アダプタ作成時にUACの許可を与えるダイアログが表示されるんだけど、初回は長時間席を外してたのでタイムアウトかなんかして(するのか?)失敗してたのかも。

SSH接続が失敗してるが、VMの状態見ながら実行してる感じだと、単にOSが起動しきっていないせいのような気がする。 (後述してるが、これ実は失敗)

というわけで、念のために更に再実行

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO A CodeReady Containers VM for OpenShift 4.2.0 is already running
The OpenShift cluster is running
WARN The cluster might report a degraded or error state. This is expected since several operators have been disable to lower the resource usage. For more information, please consult the documentation
PS C:\Users\zaki>

うごいてる。

PS C:\Users\zaki> crc status
ERRO error: CreateFile C:\Users\zaki\.crc\machines\crc\kubeconfig: The system cannot find the file specified.
 - exit status 1
PS C:\Users\zaki>

えぇ、、

失敗?

ocコマンド

ocの場所を確認

PS C:\Users\zaki> crc oc-env
$Env:PATH = "C:\Users\zaki\.crc\bin;$Env:PATH"
# Run this command to configure your shell:
# & crc oc-env | Invoke-Expression
PS C:\Users\zaki>

(一時的に)path設定

PS C:\Users\zaki> $Env:PATH = "C:\Users\zaki\.crc\bin;$Env:PATH"

oc実行

PS C:\Users\zaki> oc version
Client Version: v4.3.0
Unable to connect to the server: dial tcp 192.168.99.103:8443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
PS C:\Users\zaki>

あれ? 192.168.99.103:8443ってどこから出てきた?

PS C:\Users\zaki> crc status
ERRO error: CreateFile C:\Users\zaki\.crc\machines\crc\kubeconfig: The system cannot find the file specified.
 - exit status 1
PS C:\Users\zaki>

んん?

PS C:\Users\zaki> crc console --credentials
To login as a regular user, username is 'developer' and password is 'developer'.
To login as an admin, username is 'kubeadmin' and password is '****************'.
PS C:\Users\zaki> oc login -u developer https://api.crc.testing:6443
error: dial tcp: lookup api.crc.testing: no such host - verify you have provided the correct host and port and that the server is currently running.
PS C:\Users\zaki> 

どうも……minishiftやminikubeで使ってた.kubeを参照している感じ…… ホームディレクトリの.kubeを一旦退避。

しても、状態かわらず。

というか、api.crc.testingが名前解決できないんだよな。 そういえばLinuxCRC入れたときは、ローカルにdnsmasqがインストールされてた。

DNS configuration detailsのとこを見てみる。

winの場合は特に何も書かれてないけど、話を総合するとapi.crc.testingを名前解決するための設定はwinはされないっぽいので手動でなんとかしないとダメそう。

ちなみにアドレスは

PS C:\Users\zaki> crc ip
192.168.130.100
PS C:\Users\zaki>

これね。 ちなみにホスト名でなくてIPアドレス直接だと…

PS C:\Users\zaki> oc login -u developer https://192.168.130.100:6443
error: dial tcp 192.168.130.100:6443: connectex: No connection could be made because the target machine actively refused it. - verify you have provided the correct host and port and that the server is currently running.
PS C:\Users\zaki>

あ、だめか。
hostsに追加して再実行。

PS C:\Users\zaki> ping api.crc.testing

api.crc.testing [192.168.130.100]に ping を送信しています 32 バイトのデータ:
192.168.130.100 からの応答: バイト数 =32 時間 <1ms TTL=64
192.168.130.100 からの応答: バイト数 =32 時間 <1ms TTL=64

192.168.130.100 の ping 統計:
    パケット数: 送信 = 2、受信 = 2、損失 = 0 (0% の損失)、
ラウンド トリップの概算時間 (ミリ秒):
    最小 = 0ms、最大 = 0ms、平均 = 0ms
Ctrl+C
PS C:\Users\zaki>
PS C:\Users\zaki> oc login -u developer https://api.crc.testing:6443
error: dial tcp 192.168.130.100:6443: connectex: No connection could be made because the target machine actively refused it. - verify you have provided the correct host and port and that the server is currently running.
PS C:\Users\zaki>

うーむ…

PS C:\Users\zaki> crc status
ERRO error: CreateFile C:\Users\zaki\.crc\machines\crc\kubeconfig: The system cannot find the file specified.
 - exit status 1
PS C:\Users\zaki>

statusが見えないってのはどういうことだろう。というかkubeconfigというファイルがないんだよね。 ~/.kube/configとは別物なのかな。

PS C:\Users\zaki> crc stop
Stopping the OpenShift cluster, this may take a few minutes...
The OpenShift cluster stopped
PS C:\Users\zaki> crc status
CRC VM:          Stopped
OpenShift:       Stopped
Disk Usage:      0B of 0B (Inside the CRC VM)
Cache Usage:     9.538GB
Cache Directory: C:\Users\zaki\.crc\cache
PS C:\Users\zaki>

再起動してみる

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Starting CodeReady Containers VM for OpenShift 4.2.0...
ERRO Failed to connect to the CRC VM with SSH
PS C:\Users\zaki>

やっぱこのSSH失敗がまずそう。 デバッグレベル上げて再実行。

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle  --log-level debug
DEBU No new version available. The latest version is 1.0.0
INFO Checking if running as normal user
INFO Checking if oc binary is cached
DEBU oc binary already cached
Checking file: C:\Users\zaki\.crc\machines\crc\.crc-exist
Found binary path at C:\local\crc-windows-1.0.0-amd64\crc.exe
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:50991
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(crc) Calling .GetBundleName
(crc) Calling .DriverName
(crc) Calling .GetState
(crc) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe showvminfo crc --machinereadable
(crc) DBG | STDOUT:
(crc) DBG | {
(crc) DBG | name="crc"
INFO(crc) DBG | groups="/"
(crc) DBG | ostype="Fedora (64-bit)"
 S(crc) DBG | UUID="3e23dbf8-9be4-42b8-83db-50e23c89fc26"
:
:
(crc) DBG | Forwarding(0)="ssh,tcp,127.0.0.1,50382,,22"
(crc) DBG | hostonlyadapter2="VirtualBox Host-Only Ethernet Adapter #4"
:
:

localhost:50382をVMの22/TCPフォワードする設定になってるっぽい。

:
:
 Waiting until ssh is available
(crc) Calling .GetSSHHostname
(crc) Calling .GetSSHPort
(crc) Calling .GetSSHKeyPath
(crc) Calling .GetSSHKeyPath
(crc) Calling .GetSSHUsername
Using SSH client type: native
<nil>
DEBU error: Temporary Error: Error getting config for native Go SSH: open C:\Users\zaki\.crc\machines\crc\id_rsa: The system cannot find the file specified. - sleeping 1s
DEBU retry loop 1

あ、なるほど。秘密鍵が手元にないと…(確かに無い) これはどうにもならないな。

というわけで、一度削除しよう。

Use "crc config [command] --help" for more information about a command.
PS C:\Users\zaki> crc delete --help
Delete the OpenShift cluster

Usage:
  crc delete [flags]

Flags:
      --clear-cache   Clear the OpenShift cluster cache at: C:\Users\zaki\.crc\cache
  -h, --help          help for delete

Global Flags:
  -f, --force              Forcefully perform an action
      --log-level string   log level (e.g. "debug | info | warn | error") (default "info")
PS C:\Users\zaki>

削除

PS C:\Users\zaki> crc delete
Do you want to delete the OpenShift cluster? [y/N]: y
The OpenShift cluster deleted
PS C:\Users\zaki>

~/.crc/machines以下が消え、VMも消える。

というわけで、再度作成

crc setupは不要。crc startから。

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Loading bundle: crc_virtualbox_4.2.0.crcbundle ...
INFO Creating CodeReady Containers VM for OpenShift 4.2.0...
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 ...
:
:

あー、うまくいってる。この時点で、今まで無かったkubeconfigid_rsaも作成される

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>

再start前にhostsの設定を元に戻してたのが仇となったようだ。 (つまり要hosts設定)

PS C:\Users\zaki> crc stop
Stopping the OpenShift cluster, this may take a few minutes...
The OpenShift cluster stopped
PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Starting CodeReady Containers VM for OpenShift 4.2.0...
INFO Verifying validity of the cluster certificates ...
ERRO Error getting the IP: Could not find matching IP for MAC address 08002724343b
PS C:\Users\zaki>

うーん、、、MACアドレスがおかしいというエラー…?
考えるのを放棄して作り直し(家畜脳)

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Loading bundle: crc_virtualbox_4.2.0.crcbundle ...
INFO Creating CodeReady Containers VM for OpenShift 4.2.0...
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 192.168.130.100:6443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
)
PS C:\Users\zaki>

hostsに設定しているIPアドレスが変わっているのでは… (ホストオンリーアダプタはデフォルトでDHCP設定)

PS C:\Users\zaki> crc ip
ERRO Could not find matching IP for MAC address 08002744c8dd
PS C:\Users\zaki>

ネットワーク設定で見た限りMACアドレスはあってるぽいんだけどなぁ。 つか、VMを作って壊し手を繰り返すと、IPアドレス1ずつ増えてるっぽい。

作り直してhostsも設定して

192.168.130.103 api.crc.testing
PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Loading bundle: crc_virtualbox_4.2.0.crcbundle ...
INFO Creating CodeReady Containers VM for OpenShift 4.2.0...
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
The OpenShift cluster is running
WARN The cluster might report a degraded or error state. This is expected since several operators have been disable to lower the resource usage. For more information, please consult the documentation
PS C:\Users\zaki>

エラー無し!
crc ipが相変わらず動かないのが気になるが。。

PS C:\Users\zaki> crc ip
ERRO Could not find matching IP for MAC address 080027b62019
PS C:\Users\zaki>
PS C:\Users\zaki> crc status
CRC VM:          Running
OpenShift:       Running (v4.2.0)
Disk Usage:      9.718GB of 32.2GB (Inside the CRC VM)
Cache Usage:     9.538GB
Cache Directory: C:\Users\zaki\.crc\cache
PS C:\Users\zaki>

VirtualBoxのマネージャ上だとこんな感じ

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

oc login

PS C:\Users\zaki> oc login -u developer -p developer https://api.crc.testing:6443
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y

error: dial tcp: lookup oauth-openshift.apps-crc.testing: no such host
PS C:\Users\zaki>

追加のドメイン名設定が要る。。ワイルドカードDNS使えないとキツイな。
hostsを以下のように変更(oauth-openshift.apps-crc.testingを追加)。

192.168.130.103 api.crc.testing oauth-openshift.apps-crc.testing
PS C:\Users\zaki> oc login -u developer -p developer https://api.crc.testing:6443
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y

Login successful.

You don't have any projects. You can try to create a new project, by running

    oc new-project <projectname>

PS C:\Users\zaki>

入れた。

cluster-adminであれば、kubeadmでログインする。パスワードはstartに最後のほうに表示されたものを入力。(またはcrc console --credentialsでも確認可能)

PS C:\Users\zaki> oc login -u kubeadmin
Authentication required for https://api.crc.testing:6443 (openshift)
Username: kubeadmin
Password:
Login successful.

You have access to 51 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".
PS C:\Users\zaki> oc projects
You have access to the following projects and can switch between them with 'oc project <projectname>':

  * default
    kube-node-lease
    kube-public
    kube-system
    openshift
    openshift-apiserver
    openshift-apiserver-operator
    openshift-authentication
    openshift-authentication-operator
    openshift-cloud-credential-operator
    openshift-cluster-machine-approver
    openshift-cluster-node-tuning-operator
    openshift-cluster-samples-operator
    openshift-cluster-storage-operator
    openshift-cluster-version
    openshift-config
    openshift-config-managed
    openshift-console
    openshift-console-operator
    openshift-controller-manager
    openshift-controller-manager-operator
    openshift-dns
    openshift-dns-operator
    openshift-etcd
    openshift-image-registry
    openshift-infra
    openshift-ingress
    openshift-ingress-operator
    openshift-insights
    openshift-kni-infra
    openshift-kube-apiserver
    openshift-kube-apiserver-operator
    openshift-kube-controller-manager
    openshift-kube-controller-manager-operator
    openshift-kube-scheduler
    openshift-kube-scheduler-operator
    openshift-machine-api
    openshift-machine-config-operator
    openshift-marketplace
    openshift-monitoring
    openshift-multus
    openshift-network-operator
    openshift-node
    openshift-openstack-infra
    openshift-operator-lifecycle-manager
    openshift-operators
    openshift-sdn
    openshift-service-ca
    openshift-service-ca-operator
    openshift-service-catalog-apiserver-operator
    openshift-service-catalog-controller-manager-operator

Using project "default" on server "https://api.crc.testing:6443".
PS C:\Users\zaki>

動いた

ERRO Error getting the IP: Could not find matching IP for MAC address

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Starting CodeReady Containers VM for OpenShift 4.2.0...
INFO Verifying validity of the cluster certificates ...
ERRO Error getting the IP: Could not find matching IP for MAC address 080027b62019

stopして再度startすると、やっぱり同じエラーが発生する。 なぜ。。

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle --pull-secret-file .\Downloads\pull-secret.txt
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Starting CodeReady Containers VM for OpenShift 4.2.0...
INFO Verifying validity of the cluster certificates ...
ERRO Error getting the IP: Could not find matching IP for MAC address 080027b62019

VMの設定のMACアドレスは合っているんだけどな。

……検索したらIssue発見。 github.com

エラーメッセージはMACアドレスの不一致だけど、SSH秘密鍵が合ってなかったのが原因のようだ。

PS C:\Users\zaki> mv .\.crc\cache\crc_virtualbox_4.2.0\id_rsa_crc .\.crc\cache\crc_virtualbox_4.2.0\id_rsa_crc.org
PS C:\Users\zaki> cp .\.crc\machines\crc\id_rsa .\.crc\cache\crc_virtualbox_4.2.0\id_rsa_crc
PS C:\Users\zaki>

.crc/cache/crc_virtualbox_4.2.0/id_rsaにあるファイルを、.crc/machines/crc/id_rsaで上書きすればOK

これで起動できるようになるはず。

PS C:\Users\zaki> crc start --vm-driver virtualbox --bundle .\Downloads\crc_virtualbox_4.2.0.crcbundle
INFO Checking if running as normal user
INFO Checking if oc binary is cached
INFO Starting CodeReady Containers VM for OpenShift 4.2.0...
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 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
The OpenShift cluster is running
WARN The cluster might report a degraded or error state. This is expected since several operators have been disable to lower the resource usage. For more information, please consult the documentation
PS C:\Users\zaki>