「Multipass」の版間の差分
ナビゲーションに移動
検索に移動
(同じ利用者による、間の43版が非表示) | |||
1行目: | 1行目: | ||
+ | | [[MicroK8s]] | [[VirtualBox]] | [[Ubuntu]] | [[KVM]] | [[TCP/IP]] | [[Linux]] | | ||
+ | ==Multipass== | ||
*https://multipass.run/ | *https://multipass.run/ | ||
+ | ===Install=== | ||
+ | ---- | ||
+ | ====[[Ubuntu]]==== | ||
+ | ---- | ||
+ | <pre> | ||
+ | $ sudo snap install multipass | ||
+ | </pre> | ||
+ | |||
+ | =====QEMU===== | ||
+ | *Ubuntuの標準バックエンドは、[[KVM|QEMU]] | ||
+ | =====[https://www.typea.info/blog/index.php/2021/03/10/create_ubuntu_multipass_kvm_bridge_network/ UbuntuでMultipass(KVM)のブリッジネットワーク環境を構築]===== | ||
+ | *[https://www.typea.info/blog/index.php/2021/03/10/create_ubuntu_multipass_kvm_bridge_network/ UbuntuでMultipass(KVM)のブリッジネットワーク環境を構築] | ||
+ | |||
+ | ====[[Windows]]==== | ||
+ | ---- | ||
+ | *インストーラをダウンロード | ||
+ | *管理者として実行 | ||
+ | *途中で、[[Hyper-V]] もしくは [[VirtualBox]] を選択 | ||
+ | [[File:ultipass_install_windows.png|400px]] | ||
+ | =====WindowsでMultipassを利用する===== | ||
+ | *https://multipass.run/docs/using-virtualbox-in-multipass-windows | ||
+ | *https://xtech.nikkei.com/it/article/COLUMN/20120601/399944/ | ||
+ | |||
+ | VirtualBox管理画面に、Multipassを表示する | ||
+ | *PsExecをダウンロードし解凍、PowerShellを管理者で実行し、解凍PsExecで、VirtualBoxを起動 | ||
+ | *https://docs.microsoft.com/en-us/sysinternals/downloads/psexecPsExec | ||
+ | <pre> | ||
+ | PS C:\Programs\PSTools> & .\PsExec.exe -s -i 'C:\Program Files\Oracle\VirtualBox\VirtualBox.exe' | ||
+ | </pre> | ||
+ | [[File:multipass_win_virtualbox.png|600px]] | ||
+ | |||
+ | =====[https://www.typea.info/blog/index.php/2021/03/06/create_vbox_bridgenw_on_multipass_windows/ WIndowsでMultipass(VirtualBox)のブリッジネットワークを構成する手順]===== | ||
+ | ---- | ||
+ | *[https://www.typea.info/blog/index.php/2021/03/06/create_vbox_bridgenw_on_multipass_windows/ WIndowsでMultipass(VirtualBox)のブリッジネットワークを構成する手順] | ||
+ | =====Windowsの場合インスタンス場所===== | ||
+ | ---- | ||
+ | C:\Windows\System32\config\systemprofile\AppData\Roaming\multipassd\virtualbox\vault\instances | ||
+ | |||
+ | ====[[Mac]]==== | ||
+ | ---- | ||
+ | =====[https://www.typea.info/blog/index.php/2020/11/20/mac_multipass_microk8s_virtuabox_networibridge/ Mac+Multipass+MicroK8s+Virtual Boxでネットワークブリッジを構成する]===== | ||
+ | *[https://www.typea.info/blog/index.php/2020/11/20/mac_multipass_microk8s_virtuabox_networibridge/ Mac+Multipass+MicroK8s+Virtual Boxでネットワークブリッジを構成する] | ||
+ | |||
+ | ===Multipass自体の停止と開始=== | ||
+ | <pre> | ||
+ | $ sudo snap stop multipass | ||
+ | Stopped. | ||
+ | $ sudo snap start multipass | ||
+ | Started. | ||
+ | </pre> | ||
+ | ===インスタンスの作成と開始=== | ||
+ | ---- | ||
+ | <pre> | ||
+ | $ multipass launch --mem 8G --disk 40G --cpus 2 --name primary | ||
+ | </pre> | ||
+ | [https://www.typea.info/blog/index.php/2021/03/10/create_ubuntu_multipass_kvm_bridge_network/ その他準備] | ||
+ | ===インスタンスの削除=== | ||
+ | ---- | ||
+ | <pre> | ||
+ | root@puli:~# multipass delete vmname | ||
+ | root@puli:~# multipass purge | ||
+ | </pre> | ||
+ | |||
+ | ==コマンド== | ||
+ | ====ls==== | ||
+ | ---- | ||
+ | *インスタンスの列挙 | ||
+ | <pre> | ||
+ | $ multipass ls | ||
+ | Name State IPv4 Image | ||
+ | microk8s-vm Running 192.168.64.2 Ubuntu 18.04 LTS | ||
+ | </pre> | ||
+ | ===shell=== | ||
+ | ---- | ||
+ | *インスタンスにログイン | ||
+ | <pre> | ||
+ | $ multipass shell microk8s-vm | ||
+ | Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-122-generic x86_64) | ||
+ | : | ||
+ | ubuntu@microk8s-vm:~$ | ||
+ | </pre> | ||
+ | |||
+ | ===ローカルドライブをマウント=== | ||
+ | *マウント | ||
+ | <pre> | ||
+ | $ multipass mount $HOME/Workspaces/microk8s microk8s-vm:/home/ubuntu/manifest | ||
+ | </pre> | ||
+ | *確認 | ||
+ | <pre> | ||
+ | $ multipass info microk8s-vm | ||
+ | Name: microk8s-vm | ||
+ | State: Running | ||
+ | IPv4: 192.168.64.2 | ||
+ | Release: Ubuntu 18.04.5 LTS | ||
+ | Image hash: a85c3190d0bb (Ubuntu 18.04 LTS) | ||
+ | Load: 0.79 0.95 1.02 | ||
+ | Disk usage: 3.1G out of 48.3G | ||
+ | Memory usage: 1.0G out of 3.9G | ||
+ | Mounts: /Users/hirotoyagi/Workspaces/microk8s => /home/ubuntu/manifest | ||
+ | UID map: 501:default | ||
+ | GID map: 20:default | ||
+ | </pre> | ||
+ | *解除 | ||
+ | <pre> | ||
+ | $ multipass unmount microk8s-vm | ||
+ | </pre> | ||
==Tips== | ==Tips== | ||
9行目: | 117行目: | ||
</pre> | </pre> | ||
− | ===ドライバを[[ | + | ===ドライバを[[VirtualBox]]に変更=== |
*https://multipass.run/docs/using-virtualbox-in-multipass-macos | *https://multipass.run/docs/using-virtualbox-in-multipass-macos | ||
<pre> | <pre> | ||
16行目: | 124行目: | ||
Password: | Password: | ||
"microk8s-vm" {d90718db-3795-4116-825f-cffe4a2f0fea} | "microk8s-vm" {d90718db-3795-4116-825f-cffe4a2f0fea} | ||
+ | </pre> | ||
+ | *Bridge | ||
+ | **https://www.virtualbox.org/manual/ch06.html#network_bridged | ||
+ | <pre> | ||
+ | $ VBoxManage list bridgedifs | grep ^Name: | ||
+ | Name: en0: Wi-Fi (AirPort) | ||
+ | Name: en1: Thunderbolt 1 | ||
+ | Name: bridge0 | ||
+ | Name: p2p0 | ||
+ | Name: awdl0 | ||
+ | Name: llw0 | ||
+ | |||
+ | $ sudo VBoxManage modifyvm microk8s-vm --nic2 bridged --bridgeadapter2 en0 | ||
+ | </pre> | ||
+ | *インスタンスを立ち上げて新しいNICの名前(enp0s8)を得る | ||
+ | <pre> | ||
+ | $ multipass exec microk8s-vm ip link | grep DOWN | ||
+ | 3: enp0s8: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 | ||
+ | </pre> | ||
+ | *新しいNIC(enp0s8)の設定 | ||
+ | <pre> | ||
+ | $ multipass exec -- microk8s-vm sudo bash -c "cat > /etc/netplan/60-bridge.yaml" <<EOF | ||
+ | network: | ||
+ | ethernets: | ||
+ | enp0s8: # this is the interface name from above | ||
+ | dhcp4: true | ||
+ | dhcp4-overrides: # this is needed so the default gateway | ||
+ | route-metric: 200 # remains with the first interface | ||
+ | version: 2 | ||
+ | EOF | ||
+ | |||
+ | $ multipass exec microk8s-vm sudo netplan apply | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | $ multipass exec microk8s-vm ip address show dev enp0s8 up | ||
+ | 3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 | ||
+ | link/ether 08:00:27:3a:92:dd brd ff:ff:ff:ff:ff:ff | ||
+ | inet 192.168.0.40/24 brd 192.168.0.255 scope global dynamic enp0s8 | ||
+ | valid_lft 86331sec preferred_lft 86331sec | ||
+ | inet6 2402:6b00:3666:5800:a00:27ff:fe3a:92dd/64 scope global dynamic mngtmpaddr noprefixroute | ||
+ | valid_lft 266sec preferred_lft 266sec | ||
+ | inet6 fe80::a00:27ff:fe3a:92dd/64 scope link | ||
+ | valid_lft forever preferred_lft forever | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | $ microk8s add-node | ||
+ | From the node you wish to join to this cluster, run the following: | ||
+ | microk8s join 10.0.2.15:25000/136ac2967078d5490de2d1a2d3a8bf52 | ||
+ | |||
+ | If the node you are adding is not reachable through the default interface you can use one of the following: | ||
+ | microk8s join 10.0.2.15:25000/136ac2967078d5490de2d1a2d3a8bf52 | ||
+ | microk8s join 192.168.0.40:25000/136ac2967078d5490de2d1a2d3a8bf52 | ||
</pre> | </pre> |
2023年5月2日 (火) 08:40時点における最新版
| MicroK8s | VirtualBox | Ubuntu | KVM | TCP/IP | Linux |
Multipass
Install
Ubuntu
$ sudo snap install multipass
QEMU
- Ubuntuの標準バックエンドは、QEMU
UbuntuでMultipass(KVM)のブリッジネットワーク環境を構築
Windows
- インストーラをダウンロード
- 管理者として実行
- 途中で、Hyper-V もしくは VirtualBox を選択
WindowsでMultipassを利用する
- https://multipass.run/docs/using-virtualbox-in-multipass-windows
- https://xtech.nikkei.com/it/article/COLUMN/20120601/399944/
VirtualBox管理画面に、Multipassを表示する
- PsExecをダウンロードし解凍、PowerShellを管理者で実行し、解凍PsExecで、VirtualBoxを起動
- https://docs.microsoft.com/en-us/sysinternals/downloads/psexecPsExec
PS C:\Programs\PSTools> & .\PsExec.exe -s -i 'C:\Program Files\Oracle\VirtualBox\VirtualBox.exe'
WIndowsでMultipass(VirtualBox)のブリッジネットワークを構成する手順
Windowsの場合インスタンス場所
C:\Windows\System32\config\systemprofile\AppData\Roaming\multipassd\virtualbox\vault\instances
Mac
Mac+Multipass+MicroK8s+Virtual Boxでネットワークブリッジを構成する
Multipass自体の停止と開始
$ sudo snap stop multipass Stopped. $ sudo snap start multipass Started.
インスタンスの作成と開始
$ multipass launch --mem 8G --disk 40G --cpus 2 --name primary
インスタンスの削除
root@puli:~# multipass delete vmname root@puli:~# multipass purge
コマンド
ls
- インスタンスの列挙
$ multipass ls Name State IPv4 Image microk8s-vm Running 192.168.64.2 Ubuntu 18.04 LTS
shell
- インスタンスにログイン
$ multipass shell microk8s-vm Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-122-generic x86_64) : ubuntu@microk8s-vm:~$
ローカルドライブをマウント
- マウント
$ multipass mount $HOME/Workspaces/microk8s microk8s-vm:/home/ubuntu/manifest
- 確認
$ multipass info microk8s-vm Name: microk8s-vm State: Running IPv4: 192.168.64.2 Release: Ubuntu 18.04.5 LTS Image hash: a85c3190d0bb (Ubuntu 18.04 LTS) Load: 0.79 0.95 1.02 Disk usage: 3.1G out of 48.3G Memory usage: 1.0G out of 3.9G Mounts: /Users/hirotoyagi/Workspaces/microk8s => /home/ubuntu/manifest UID map: 501:default GID map: 20:default
- 解除
$ multipass unmount microk8s-vm
Tips
現在選択されているドライバを確認する
$ sudo multipass get local.driver hyperkit
ドライバをVirtualBoxに変更
$ sudo multipass set local.driver=virtualbox $ sudo VBoxManage list vms Password: "microk8s-vm" {d90718db-3795-4116-825f-cffe4a2f0fea}
$ VBoxManage list bridgedifs | grep ^Name: Name: en0: Wi-Fi (AirPort) Name: en1: Thunderbolt 1 Name: bridge0 Name: p2p0 Name: awdl0 Name: llw0 $ sudo VBoxManage modifyvm microk8s-vm --nic2 bridged --bridgeadapter2 en0
- インスタンスを立ち上げて新しいNICの名前(enp0s8)を得る
$ multipass exec microk8s-vm ip link | grep DOWN 3: enp0s8: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
- 新しいNIC(enp0s8)の設定
$ multipass exec -- microk8s-vm sudo bash -c "cat > /etc/netplan/60-bridge.yaml" <<EOF network: ethernets: enp0s8: # this is the interface name from above dhcp4: true dhcp4-overrides: # this is needed so the default gateway route-metric: 200 # remains with the first interface version: 2 EOF $ multipass exec microk8s-vm sudo netplan apply
$ multipass exec microk8s-vm ip address show dev enp0s8 up 3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:3a:92:dd brd ff:ff:ff:ff:ff:ff inet 192.168.0.40/24 brd 192.168.0.255 scope global dynamic enp0s8 valid_lft 86331sec preferred_lft 86331sec inet6 2402:6b00:3666:5800:a00:27ff:fe3a:92dd/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 266sec preferred_lft 266sec inet6 fe80::a00:27ff:fe3a:92dd/64 scope link valid_lft forever preferred_lft forever
$ microk8s add-node From the node you wish to join to this cluster, run the following: microk8s join 10.0.2.15:25000/136ac2967078d5490de2d1a2d3a8bf52 If the node you are adding is not reachable through the default interface you can use one of the following: microk8s join 10.0.2.15:25000/136ac2967078d5490de2d1a2d3a8bf52 microk8s join 192.168.0.40:25000/136ac2967078d5490de2d1a2d3a8bf52
© 2006 矢木浩人