วันอาทิตย์ที่ 2 กุมภาพันธ์ พ.ศ. 2563

[Linux Container] - สร้าง Network และ Storage ไว้ก่อนแล้วค่อยมา Init

การใช้งาน Linux Container สักพักหนึ่งก็พบความไม่สะดวกในการใช้งาน Network กับ Storage ตอนที่ทำการ Init
Network ปกติจะ Init เป็น 10.x.x.x ทำให้ชนกับ Network ภายใน และ Storage ก็เพิ่มได้ยากเพราะหาไม่เจอ เลยทำการสร้างไว้ก่อน

สร้าง Network -> https://im-jumbo.blogspot.com/2019/04/how-to-use-lxc-network.html
สร้าง Storage -> https://im-jumbo.blogspot.com/2019/08/linux-container-storage-pool-lxc-storage.html

เมื่อทำการสร้าง Network กับ Storage เสร็จแล้วก็ทำการ Init ตามปกติ
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-76-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Feb  3 14:55:06 +07 2020

  System load:  0.0               Users logged in:       0
  Usage of /:   7.8% of 77.26GB   IP address for ens192: 10.1.4.50
  Memory usage: 3%                IP address for ens224: 192.168.0.115
  Swap usage:   0%                IP address for lxdbr1: 172.168.0.1
  Processes:    202

 * Overheard at KubeCon: "microk8s.status just blew my mind".

     https://microk8s.io/docs/commands#microk8s.status

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

0 packages can be updated.
0 updates are security updates.

Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. 
Check your Internet connection or proxy settings


Last login: Mon Feb  3 14:44:48 2020 from 192.168.0.251
sarankon@conf:~$ lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]: no
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: lxdbr1
Would you like LXD to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
sarankon@conf:~$