LoginSignup
15
22

More than 5 years have passed since last update.

Minishiftを使ってVirtualBox上にOpenShift環境をつくる

Last updated at Posted at 2018-11-05

Red Hatがリリースしているコンテナのオーケストレーション環境であるOpenShiftをオールインワン構成で構築してくれるMinishiftを、Windows上にインストールしたVirtualBoxでセットアップする。

minishift_install.png

以下、ざっくりとした簡単な用語の説明(個人の感想です)

  • OpenShiftとは… コンテナのオーケストレーションツールの一つ。Kubernetesがベースになっている。
  • Kubernetesとは… 元はGoogleが開発していたコンテナのオーケストレーションツール。最近はデファクトになってる気がする。
  • コンテナオーケストレーションツールとは… コンテナ運用の可用性等を高めるために、スケーリングやスケジューリング・監視などやってくれるツール
  • オールインワン構成とは… 通常オーケストレーションツールでコンテナ運用する場合は、複数のVMなどのマシン(ノードと言われる)上でコンテナを動かすことで可用性を高めるが、試用・検証目的などで最小の構成としてノード1台ですべて済ませるような構成を言う。

素のOpenShiftを構築する場合は、使用するノードとなるVMをすべて用意したうえでそこへOpenShiftをインストールするが、MinishiftはノードとなるVM自体を仮想環境(VirtualBoxなど)に作成するところも含めてOpenShift環境を構築してくれる。
機能としてはWindows7とかにDocker環境を作る時のDocker Toolboxにとても近い(と思う)。

※ ここを盛大に勘違いしており、VM上にノードとなるCentOSをインストールしておき、そこでMinishiftを使うことで、CentOS上にオールインワンのOpenShift環境ができると思い込んでいて、VirtualBoxの仕様でVM内でkvmが使えずにハマっていた…


ホストOS用Windows版Minishiftをダウンロード

場所はどこでもいいけれど、今回はC:\local\minishift-1.26.1-windows-amd64へzipを展開。
環境変数PATHを設定し、コマンドプロンプトでminishiftが実行できるようにする。

Microsoft Windows [Version 10.0.17134.345]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\zaki>minishift version
minishift v1.26.1+1e20f27

C:\Users\zaki>

Minishiftインストール

Minishiftインストールというよりは、オールインワン構成のOpenShiftのインストール

C:\Users\zaki>minishift start --vm-driver virtualbox
-- Starting profile 'minishift'
-- Check if deprecated options are used ... OK
-- Checking if https://github.com is reachable ... OK
-- Checking if requested OpenShift version 'v3.11.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.11.0' is supported ... OK
-- Checking if requested hypervisor 'virtualbox' is supported on this platform ... OK
-- Checking if VirtualBox is installed ... OK
-- Checking the ISO URL ... OK
-- Downloading OpenShift binary 'oc' version 'v3.11.0'
 53.59 MiB / 53.59 MiB [===================================================================================] 100.00% 0s-- Downloading OpenShift v3.11.0 checksums ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting the OpenShift cluster using 'virtualbox' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    4 GB
   vCPUs :    2
   Disk size: 20 GB

   Downloading ISO 'https://github.com/minishift/minishift-centos-iso/releases/download/v1.13.0/minishift-centos7.iso'
 346.00 MiB / 346.00 MiB [=================================================================================] 100.00% 0s
-- Starting Minishift VM .................................... OK
-- Checking for IP address ... OK
-- Checking for nameservers ... OK
-- Checking if external host is reachable from the Minishift VM ...
   Pinging 8.8.8.8 ... OK
-- Checking HTTP connectivity from the VM ...
   Retrieving http://minishift.io/index.html ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 1% used OK
-- Writing current configuration for static assignment of IP address ... OK
   Importing 'openshift/origin-control-plane:v3.11.0'  CACHE MISS
   Importing 'openshift/origin-docker-registry:v3.11.0'  CACHE MISS
   Importing 'openshift/origin-haproxy-router:v3.11.0' . CACHE MISS
-- OpenShift cluster will be configured with ...
   Version: v3.11.0
-- Pulling the Openshift Container Image ...................... OK
-- Copying oc binary from the OpenShift container image to VM ... OK
-- Starting OpenShift cluster ...................................................................
Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.11.0 is available ...
Pulling image openshift/origin-cli:v3.11.0
E1104 13:17:39.802377    2498 helper.go:173] Reading docker config from /home/docker/.docker/config.json failed: open /home/docker/.docker/config.json: no such file or directory, will attempt to pull image docker.io/openshift/origin-cli:v3.11.0 anonymously
Image pull complete
Pulling image openshift/origin-node:v3.11.0
E1104 13:17:43.325731    2498 helper.go:173] Reading docker config from /home/docker/.docker/config.json failed: open /home/docker/.docker/config.json: no such file or directory, will attempt to pull image docker.io/openshift/origin-node:v3.11.0 anonymously
Pulled 5/6 layers, 85% complete
Pulled 6/6 layers, 100% complete
Extracting
Image pull complete
Checking type of volume mount ...
Determining server IP ...
Using public hostname IP 192.168.99.100 as the host IP
Checking if OpenShift is already running ...
Checking for supported Docker version (=>1.22) ...
Checking if insecured registry is configured properly in Docker ...
Checking if required ports are available ...
Checking if OpenShift client is configured properly ...
Checking if image openshift/origin-control-plane:v3.11.0 is available ...
Starting OpenShift using openshift/origin-control-plane:v3.11.0 ...
I1104 13:18:05.741721    2498 config.go:40] Running "create-master-config"
I1104 13:18:09.942253    2498 config.go:46] Running "create-node-config"
I1104 13:18:11.888667    2498 flags.go:30] Running "create-kubelet-flags"
I1104 13:18:12.327550    2498 run_kubelet.go:49] Running "start-kubelet"
I1104 13:18:12.513911    2498 run_self_hosted.go:181] Waiting for the kube-apiserver to be ready ...
I1104 13:19:27.575922    2498 interface.go:26] Installing "kube-proxy" ...
I1104 13:19:27.575965    2498 interface.go:26] Installing "kube-dns" ...
I1104 13:19:27.575976    2498 interface.go:26] Installing "openshift-service-cert-signer-operator" ...
I1104 13:19:27.575985    2498 interface.go:26] Installing "openshift-apiserver" ...
I1104 13:19:27.576072    2498 apply_template.go:81] Installing "openshift-apiserver"
I1104 13:19:27.577131    2498 apply_template.go:81] Installing "kube-proxy"
I1104 13:19:27.579981    2498 apply_template.go:81] Installing "kube-dns"
I1104 13:19:27.580463    2498 apply_template.go:81] Installing "openshift-service-cert-signer-operator"
I1104 13:19:37.444786    2498 interface.go:41] Finished installing "kube-proxy" "kube-dns" "openshift-service-cert-signer-operator" "openshift-apiserver"
I1104 13:21:33.108938    2498 run_self_hosted.go:242] openshift-apiserver available
I1104 13:21:33.109684    2498 interface.go:26] Installing "openshift-controller-manager" ...
I1104 13:21:33.109726    2498 apply_template.go:81] Installing "openshift-controller-manager"
I1104 13:21:39.231812    2498 interface.go:41] Finished installing "openshift-controller-manager"
Adding default OAuthClient redirect URIs ...
Adding sample-templates ...
Adding web-console ...
Adding centos-imagestreams ...
Adding registry ...
Adding router ...
Adding persistent-volumes ...
I1104 13:21:39.277759    2498 interface.go:26] Installing "sample-templates" ...
I1104 13:21:39.277772    2498 interface.go:26] Installing "openshift-web-console-operator" ...
I1104 13:21:39.277781    2498 interface.go:26] Installing "centos-imagestreams" ...
I1104 13:21:39.277788    2498 interface.go:26] Installing "openshift-image-registry" ...
I1104 13:21:39.277805    2498 interface.go:26] Installing "openshift-router" ...
I1104 13:21:39.277813    2498 interface.go:26] Installing "persistent-volumes" ...
I1104 13:21:39.278484    2498 interface.go:26] Installing "sample-templates/dancer quickstart" ...
I1104 13:21:39.278501    2498 interface.go:26] Installing "sample-templates/django quickstart" ...
I1104 13:21:39.278508    2498 interface.go:26] Installing "sample-templates/postgresql" ...
I1104 13:21:39.278514    2498 interface.go:26] Installing "sample-templates/cakephp quickstart" ...
I1104 13:21:39.278522    2498 interface.go:26] Installing "sample-templates/nodejs quickstart" ...
I1104 13:21:39.278528    2498 interface.go:26] Installing "sample-templates/rails quickstart" ...
I1104 13:21:39.278533    2498 interface.go:26] Installing "sample-templates/jenkins pipeline ephemeral" ...
I1104 13:21:39.278539    2498 interface.go:26] Installing "sample-templates/mongodb" ...
I1104 13:21:39.278545    2498 interface.go:26] Installing "sample-templates/mariadb" ...
I1104 13:21:39.278550    2498 interface.go:26] Installing "sample-templates/mysql" ...
I1104 13:21:39.278555    2498 interface.go:26] Installing "sample-templates/sample pipeline" ...
I1104 13:21:39.278632    2498 apply_list.go:67] Installing "sample-templates/sample pipeline"
I1104 13:21:39.279148    2498 apply_template.go:81] Installing "openshift-web-console-operator"
I1104 13:21:39.279492    2498 apply_list.go:67] Installing "centos-imagestreams"
I1104 13:21:39.280953    2498 apply_list.go:67] Installing "sample-templates/dancer quickstart"
I1104 13:21:39.281525    2498 apply_list.go:67] Installing "sample-templates/django quickstart"
I1104 13:21:39.281725    2498 apply_list.go:67] Installing "sample-templates/postgresql"
I1104 13:21:39.281882    2498 apply_list.go:67] Installing "sample-templates/cakephp quickstart"
I1104 13:21:39.282041    2498 apply_list.go:67] Installing "sample-templates/nodejs quickstart"
I1104 13:21:39.282196    2498 apply_list.go:67] Installing "sample-templates/rails quickstart"
I1104 13:21:39.282422    2498 apply_list.go:67] Installing "sample-templates/jenkins pipeline ephemeral"
I1104 13:21:39.282578    2498 apply_list.go:67] Installing "sample-templates/mongodb"
I1104 13:21:39.282732    2498 apply_list.go:67] Installing "sample-templates/mariadb"
I1104 13:21:39.282899    2498 apply_list.go:67] Installing "sample-templates/mysql"
I1104 13:22:01.781240    2498 interface.go:41] Finished installing "sample-templates/dancer quickstart" "sample-templates/django quickstart" "sample-templates/postgresql" "sample-templates/cakephp quickstart" "sample-templates/nodejs quickstart" "sample-templates/rails quickstart" "sample-templates/jenkins pipeline ephemeral" "sample-templates/mongodb" "sample-templates/mariadb" "sample-templates/mysql" "sample-templates/sample pipeline"
I1104 13:22:56.316878    2498 interface.go:41] Finished installing "sample-templates" "openshift-web-console-operator" "centos-imagestreams" "openshift-image-registry" "openshift-router" "persistent-volumes"
Login to server ...
Creating initial project "myproject" ...
Server Information ...
OpenShift server started.

The server is accessible via web console at:
    https://192.168.99.100:8443/console

You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin


-- Exporting of OpenShift images is occuring in background process with pid 3044.

C:\Users\zaki>

これでOpenShiftが動作するVM(ノード)が作成され、OpenShiftが起動している。

image.png

コンソールアクセス

ブラウザでコンソール(表示されているアドレス)にアクセスする。
上記ログであればhttps://192.168.99.100:8443/consoleにアクセス。SSL証明書エラーは…無視で。
認証アカウントはユーザ名にdeveloper、パスワードは何でも適当に入力。

image.png

image.png

ちゃんと動いてる。

ただ、CPU負荷的に結構重い。

ノードにシェルログインする

minishift sshでシェルログインできる

C:\Users\zaki>minishift ssh
[docker@minishift ~]$ 
[docker@minishift ~]$ uname -a
Linux minishift 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[docker@minishift ~]$
[docker@minishift ~]$ df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/live-rw  9.8G  701M  9.0G   8% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G     0  2.0G   0% /dev/shm
tmpfs                2.0G   36M  1.9G   2% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sr0             346M  346M     0 100% /run/initramfs/live
/dev/sda1             19G  2.3G   17G  13% /mnt/sda1
tmpfs                396M     0  396M   0% /run/user/0
tmpfs                396M     0  396M   0% /run/user/1000
[docker@minishift ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:           3.9G        1.4G        133M         36M        2.3G        2.1G
Swap:          999M        520K        999M
[docker@minishift ~]$ oc
-bash: oc: command not found

ocコマンドは入っていないらしい。。基本的にノード上にログインして作業することは想定されていないようだ。

ocコマンドはどこ

minishift oc-envを実行すると表示される。

C:\Users\zaki>minishift oc-env
SET PATH=C:\Users\zaki\.minishift\cache\oc\v3.11.0\windows;%PATH%
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('minishift oc-env') DO @call %i

C:\Users\zaki>

ちなみに(cygwinとかの)zshとかで実行すると、そのシェルに合わせた出力になるようだ。賢いな。

zaki@mascarpone% minishift oc-env
export PATH="C:\Users\zaki\.minishift\cache\oc\v3.11.0\windows:$PATH"
# Run this command to configure your shell:
# eval $(minishift oc-env)

パスに追加(zsh)

zaki@mascarpone% eval $(minishift oc-env)
zaki@mascarpone% oc version
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth SSPI Kerberos SPNEGO

Server https://192.168.99.100:8443
kubernetes v1.11.0+d4cacc0

ocコマンド実行

zaki@mascarpone% oc whoami
developer
zaki@mascarpone% oc project
Using project "myproject" from context named "minishift" on server "https://192.168.99.100:8443".
zaki@mascarpone% oc projects
You have one project on this server: "My Project (myproject)".

Using project "myproject" from context named "minishift" on server "https://192.168.99.100:8443".

初期状態でmyprojectプロジェクトと、そのプロジェクト用のdeveloperユーザが作られる模様

プロジェクト一覧

zaki@mascarpone% oc login -u system:admin                                   [~]
Logged into "https://192.168.99.100:8443" as "system:admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project <projectname>':

    default
    kube-dns
    kube-proxy
    kube-public
    kube-system
  * myproject
    openshift
    openshift-apiserver
    openshift-controller-manager
    openshift-core-operators
    openshift-infra
    openshift-node
    openshift-service-cert-signer
    openshift-web-console

Using project "myproject".

Pod一覧

zaki@mascarpone% oc get node
NAME        STATUS    ROLES     AGE       VERSION
localhost   Ready     <none>    1d        v1.11.0+d4cacc0
zaki@mascarpone% oc get pod --all-namespaces
NAMESPACE                       NAME                                                      READY     STATUS      RESTARTS   AGE
default                         docker-registry-1-6xrqz                                   1/1       Running     1          1d
default                         persistent-volume-setup-pp7gk                             0/1       Completed   0          1d
default                         router-1-8s5wm                                            1/1       Running     1          1d
kube-dns                        kube-dns-9jmcg                                            1/1       Running     1          1d
kube-proxy                      kube-proxy-q5xcd                                          1/1       Running     1          1d
kube-system                     kube-controller-manager-localhost                         1/1       Running     1          1d
kube-system                     kube-scheduler-localhost                                  1/1       Running     1          1d
kube-system                     master-api-localhost                                      1/1       Running     3          1d
kube-system                     master-etcd-localhost                                     1/1       Running     1          1d
openshift-apiserver             openshift-apiserver-vrl86                                 1/1       Running     1          1d
openshift-controller-manager    openshift-controller-manager-86fzl                        1/1       Running     1          1d
openshift-core-operators        openshift-service-cert-signer-operator-6d477f986b-qw9n6   1/1       Running     1          1d
openshift-core-operators        openshift-web-console-operator-57986c9c4f-9srks           1/1       Running     1          1d
openshift-service-cert-signer   apiservice-cabundle-injector-8ffbbb6dc-sf8t2              1/1       Running     1          1d
openshift-service-cert-signer   service-serving-cert-signer-668c45d5f-d7kwz               1/1       Running     1          1d
openshift-web-console           webconsole-5c7886b88f-hdkkg                               1/1       Running     2          1d

ImageStream一覧

zaki@mascarpone% oc get is -n openshift
NAME         DOCKER REPO                            TAGS                         UPDATED
dotnet       172.30.1.1:5000/openshift/dotnet       2.0,latest                   27 hours ago
httpd        172.30.1.1:5000/openshift/httpd        2.4,latest                   27 hours ago
jenkins      172.30.1.1:5000/openshift/jenkins      2,latest,1                   27 hours ago
mariadb      172.30.1.1:5000/openshift/mariadb      10.1,10.2,latest             27 hours ago
mongodb      172.30.1.1:5000/openshift/mongodb      2.6,3.2,3.4 + 3 more...      27 hours ago
mysql        172.30.1.1:5000/openshift/mysql        5.5,5.6,5.7 + 1 more...      27 hours ago
nginx        172.30.1.1:5000/openshift/nginx        1.10,1.12,1.8 + 1 more...    27 hours ago
nodejs       172.30.1.1:5000/openshift/nodejs       4,6,8 + 4 more...            27 hours ago
perl         172.30.1.1:5000/openshift/perl         5.16,5.20,5.24 + 2 more...   27 hours ago
php          172.30.1.1:5000/openshift/php          5.5,5.6,7.0 + 2 more...      27 hours ago
postgresql   172.30.1.1:5000/openshift/postgresql   10,9.2,9.4 + 3 more...       27 hours ago
python       172.30.1.1:5000/openshift/python       2.7,3.3,3.4 + 3 more...      27 hours ago
redis        172.30.1.1:5000/openshift/redis        3.2,latest                   27 hours ago
ruby         172.30.1.1:5000/openshift/ruby         latest,2.0,2.2 + 3 more...   27 hours ago
wildfly      172.30.1.1:5000/openshift/wildfly      10.1,11.0,12.0 + 5 more...   27 hours ago

停止する

C:\Users\zaki>minishift status
Minishift:  Running
Profile:    minishift
OpenShift:  Running (openshift v3.11.0+aeff40b-47)
DiskUsage:  13% of 19G (Mounted On: /mnt/sda1)
CacheUsage: 1.444 GB (used by oc binary, ISO or cached images)

C:\Users\zaki>minishift stop
Stopping the OpenShift cluster...
Cluster stopped.

C:\Users\zaki>

その他のコマンド

引数なしでminishiftを実行すればでてくる。
基本的にocと同様にminishift command [options]の形式。
マニュアルも参照 minishift - Command Reference | Minishift | OKD Latest

deleteでアンインストールするっぽい?

OpenShiftバージョンの指定

デフォルトでは最新版 (2018.11.06時点でver 3.11) がインストールされる。
--openshift-version <version>を指定することで、任意のバージョンのOpenShiftをインストールできる。

% minishift start --vm-driver virtualbox --openshift-version v3.9.0 --profile minishift-v3-9-31 
-- Starting profile 'minishift-v3-9-31'
-- Check if deprecated options are used ... OK
-- Checking if https://github.com is reachable ... OK
-- Checking if requested OpenShift version 'v3.9.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.9.0' is supported ... FAIL
   Minishift does not support OpenShift version v3.9.0. You need to use a version >= v3.10.0

minishift v1.26.1+1e20f27だとv3.10以降しか入れられない模様

デフォルト(latest)以外の指定で一度環境を作ってしまえば、次回以降の起動は指定不要(作成済みの環境が起動する)

プロファイル名を指定してクラスタ作成・起動

デフォルトではminishiftとなり、この名前でVMも作成される。
--profile <profilename>を指定すれば、任意の名前で作成でき、異なる設定のOpenShiftクラスタを作ることもできる。

zaki@mascarpone% minishift start --vm-driver virtualbox --openshift-version v3.9.31 --profile minishift_v3_9_31
Profile names must consist of alphanumeric characters only.

アンダーバーはダメらしい…

zaki@mascarpone% minishift start --vm-driver virtualbox --openshift-version v3.10.0 --profile minishift-v3-10 
-- Starting profile 'minishift-v3-10'

でも、ハイフンはOKらしい。。逆じゃないのかなぁ(個人の感想)

minishift-v3-10を指定して作成した場合のVirtualBoxマネージャ

image.png

ちなみに--profile minishift-v3-10を付加して起動した場合だと、起動中に

-- Switching active profile to 'minishift-v3-10'

と出力され、次回以降はminishift-v3-10がデフォルトのプロファイルとなり、--profile minishift-v3-10を付加しなくてもこれが指定される(初期プロファイルのminishiftを使いたい場合は明示的に指定する必要がある)

プロファイル一覧

zaki@mascarpone% minishift profile list
- minishift             Stopped
- minishift-v3-10       Running         (Active)
- minishift-v3-9-31     Does Not Exist
- minishift3931         Does Not Exist

デフォルトのプロファイルを設定

zaki@mascarpone% minishift profile set minishift
Profile 'minishift' set as active profile.
zaki@mascarpone% minishift profile list
- minishift             Stopped         (Active)
- minishift-v3-10       Running
- minishift-v3-9-31     Does Not Exist
- minishift3931         Does Not Exist

OpenShiftクラスタの削除

作成したVM・OpenShiftを削除する

zaki@mascarpone% minishift delete --profile minishift-v3-10 --force
Deleting the Minishift VM...
Minishift VM deleted.
zaki@mascarpone%

これでVirtualBoxのVM一覧からも削除される。
MINISHIFT_HOME以下のファイルは残っているので手動で削除する。
デフォルトでは%USERPROFILE%/.minishift以下。(プロファイル名指定時は%USERPROFILE%/.minishift/profiles/<profile-name>以下、と思う)

(追記) 「プロファイルの削除」があった

zaki@mascarpone% minishift profile delete minishift-v3-10
You are deleting the active profile. It will remove the VM and all related artifacts. Do you want to continue [y/N]?: y
Profile 'minishift-v3-10' deleted successfully.
Switching to default profile 'minishift' as the active profile.
zaki@mascarpone% 

このコマンドであれば、プロファイルディレクトリも根こそぎ削除される。

--profile指定で削除すると、削除後にデフォルトのプロファイル名が変更されないため、次回プロファイル名指定なしのminishift startを実行すると、前と同じプロファイル名で新しくOpenShiftクラスタが作成されてしまう


以下、VM内でMinishiftインストールしようとして失敗した手順

おまけ

以下、VMでCentOSを作り、そこへMinishiftを入れようとして失敗したときのログ。
同じ勘違いをしてる方がエラーメッセージでググってきたとき用。

ベースのCentOS入れる

IPアドレス・sudo関連を設定。

スナップショットも取っておく

minishiftのインストール

KVM Driverを入れる

[root@raclette ~]# curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.7.0/docker-machine-driver-kvm -o /usr/local/bin/docker-machine-driver-kvm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   615    0   615    0     0    787      0 --:--:-- --:--:-- --:--:--   787
100 11.5M  100 11.5M    0     0  1105k      0  0:00:10  0:00:10 --:--:-- 2078k
[root@raclette ~]# chmod +x /usr/local/bin/docker-machine-driver-kvm
[root@raclette ~]#
[root@raclette ~]# docker-machine-driver-kvm --version
docker-machine-driver-kvm: error while loading shared libraries: libvirt.so.0: cannot open shared object file: No such file or directory
[root@raclette ~]# yum install libvirt qemu-kvm
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ libvirt.x86_64 0:3.9.0-14.el7_5.8 を インストール

[...]

トランザクションの要約
================================================================================
インストール  2 パッケージ (+135 個の依存関係のパッケージ)

総ダウンロード容量: 42 M
インストール容量: 131 M
Is this ok [y/d/N]:

グループ設定

[zaki@raclette ~]$ sudo usermod -a -G libvirt $USER
[zaki@raclette ~]$ newgrp libvirt
[zaki@raclette ~]$

サービスを起動

[zaki@raclette ~]$ sudo systemctl start libvirtd
[zaki@raclette ~]$ sudo systemctl status libvirtd
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since 日 2018-11-04 18:36:37 JST; 3s ago
     Docs: man:libvirtd(8)
           https://libvirt.org
 Main PID: 2212 (libvirtd)
    Tasks: 19 (limit: 32768)
   CGroup: /system.slice/libvirtd.service
           tq2212 /usr/sbin/libvirtd
           tq2287 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa...
           mq2289 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa...

11月 04 18:36:37 raclette systemd[1]: Started Virtualization daemon.
11月 04 18:36:38 raclette dnsmasq[2287]: started, version 2.76 cachesize 150
11月 04 18:36:38 raclette dnsmasq[2287]: compile time options: IPv6 GNU-get...y
11月 04 18:36:38 raclette dnsmasq-dhcp[2287]: DHCP, IP range 192.168.122.2 ...h
11月 04 18:36:38 raclette dnsmasq-dhcp[2287]: DHCP, sockets bound exclusive...0
11月 04 18:36:38 raclette dnsmasq[2287]: reading /etc/resolv.conf
11月 04 18:36:38 raclette dnsmasq[2287]: using nameserver 192.168.0.11#53
11月 04 18:36:38 raclette dnsmasq[2287]: read /etc/hosts - 2 addresses
11月 04 18:36:38 raclette dnsmasq[2287]: read /var/lib/libvirt/dnsmasq/defa...s
11月 04 18:36:38 raclette dnsmasq-dhcp[2287]: read /var/lib/libvirt/dnsmasq...e
Hint: Some lines were ellipsized, use -l to show in full.
[zaki@raclette ~]$

libvirtネットワークの設定

[zaki@raclette ~]$ sudo virsh net-list --all
 名前               状態     自動起動  永続
----------------------------------------------------------
 default              動作中  はい (yes)  はい (yes)

[zaki@raclette ~]$

初期状態で問題なかった

Minishift本体のインストール

2018.11.04時点でver1.26.1が公開されている。

[zaki@raclette ~]$ curl -L -O https://github.com/minishift/minishift/releases/download/v1.26.1/minishift-1.26.1-linux-amd64.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   622    0   622    0     0    857      0 --:--:-- --:--:-- --:--:--   857
100 7914k  100 7914k    0     0  1768k      0  0:00:04  0:00:04 --:--:-- 2148k
[zaki@raclette ~]$ ll
合計 7916
-rw-r--r--. 1 zaki libvirt 8104264 11月  4 18:42 minishift-1.26.1-linux-amd64.tgz
[zaki@raclette ~]$ sha256sum minishift-1.26.1-linux-amd64.tgz
0e2cd654d8ccc1db8e75593edd4b630ab7861d1db1321387af9c854b7f8a3ee7  minishift-1.26.1-linux-amd64.tgz

展開する

[zaki@raclette ~]$ sudo tar xf minishift-1.26.1-linux-amd64.tgz -C /usr/local/
[zaki@raclette ~]$ ll /usr/local/minishift-1.26.1-linux-amd64/
合計 23172
-rw-r--r--. 1 zaki zaki    11374 10月 26 22:00 LICENSE
-rw-r--r--. 1 zaki zaki     3279 10月 26 22:00 README.adoc
-rwxrwxr-x. 1 zaki zaki 23709248 10月 26 22:00 minishift
[zaki@raclette ~]$
[zaki@raclette ~]$ sudo ln -s /usr/local/minishift-1.26.1-linux-amd64/minishift /usr/local/bin/
[zaki@raclette ~]$ ll /usr/local/bin/
合計 11816
-rwxr-xr-x. 1 root root 12096944 11月  4 18:33 docker-machine-driver-kvm
lrwxrwxrwx. 1 root root       49 11月  4 18:43 minishift -> /usr/local/minishift-1.26.1-linux-amd64/minishift
[zaki@raclette ~]$ minishift version
minishift v1.26.1+1e20f27

Minishift起動

[zaki@raclette ~]$ minishift start --vm-driver virtualbox
-- Starting profile 'minishift'
-- Check if deprecated options are used ... OK
-- Checking if https://github.com is reachable ... OK
-- Checking if requested OpenShift version 'v3.11.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.11.0' is supported ... OK
-- Checking if requested hypervisor 'virtualbox' is supported on this platform ... OK
-- Checking if VirtualBox is installed ... FAIL
   See the 'Installing Prerequisites for Minishift' topic (https://docs.okd.io/latest/minishift/getting-started/installing.html#install-prerequisites) for more information

あれ。。

[zaki@raclette ~]$
[zaki@raclette ~]$ minishift start
-- Starting profile 'minishift'
-- Check if deprecated options are used ... OK
-- Checking if https://github.com is reachable ... OK
-- Checking if requested OpenShift version 'v3.11.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.11.0' is supported ... OK
-- Checking if requested hypervisor 'kvm' is supported on this platform ... OK
-- Checking if KVM driver is installed ...
   Driver is available at /usr/local/bin/docker-machine-driver-kvm ...
   Checking driver binary is executable ... OK
-- Checking if Libvirt is installed ... OK
-- Checking if Libvirt default network is present ... OK
-- Checking if Libvirt default network is active ... OK
-- Checking the ISO URL ... OK
-- Downloading OpenShift binary 'oc' version 'v3.11.0'
 53.89 MiB / 53.89 MiB [============================================] 100.00% 0s-- Downloading OpenShift v3.11.0 checksums ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting the OpenShift cluster using 'kvm' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    4 GB
   vCPUs :    2
   Disk size: 20 GB

   Downloading ISO 'https://github.com/minishift/minishift-centos-iso/releases/download/v1.13.0/minishift-centos7.iso'
 346.00 MiB / 346.00 MiB [==========================================] 100.00% 0s
-- Starting Minishift VM ....... FAIL E1104 18:48:16.860971    2375 start.go:491] Error starting the VM: Error creating the VM. Error creating machine: Error in driver during machine creation: [Code-8] [Domain-44] 無効な引数: could not find capabilities for domaintype=kvm . Retrying.
Error starting the VM: Error creating the VM. Error creating machine: Error in driver during machine creation: [Code-8] [Domain-44] 無効な引数: could not find capabilities for domaintype=kvm
15
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
22