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:~$
เมื่อเราทำการ Init เสร็จแล้วเราจะได้ Profile มาชื่อว่า default เพื่อใช้งานเวลาที่เราสร้าง Container
ลองทำการ Show รายละเอียดของ Profile ดูจะเห็นว่ามีส่วนของ Network มาแล้วได้จากตอนที่เรา Init แล้วเลือก lxdbr1
*lxdbr1 สร้างไว้ก่อนแล้ว
sarankon@conf:~$ lxc profile show default
config: {}
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr1
type: nic
name: default
used_by: []
sarankon@conf:~$
ส่วนสิ่งที่เราต้องเพิ่มคือ Disk สำหรับเก็บไฟล์
อ่านเพิ่มเติมที่ -> lxd.readthedocs.io/en/stable-3.0/containers/#type-disk
ลองพิมพ์คำสั่งไปเพื่อดูโครงสร้างคำสั่งว่าต้องใช้ยังไงก่อน
sarankon@conf:~$ lxc profile device add Description: Add devices to containers or profiles Usage: lxc profile device add [<remote>:]<container profile=""> <device> <type> [key=value...] [flags]
เสร็จแล้วทำการเพิ่ม Device ชื่อ Root ประเภท Disk ไปที่ Profile ชื่อ Default โดยกำหนด Path ใน Container เป็น / แล้วกำหนด Pool เป็น standard
*Pool ชื่อ standard สร้างไว้ก่อนแล้ว
sarankon@conf:~$ lxc profile device add default root disk path=/ pool=standard Device root added to default
เสร็จแล้วลองตรวจสอบโดยให้ Show Profile อีกครั้ง ก็จะมี root: ขึ้นมาเท่านี้ก็ใช้งานได้แล้ว
sarankon@conf:~$ lxc profile show default
config: {}
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr1
type: nic
root:
path: /
pool: standard
type: disk
name: default
used_by: []
sarankon@conf:~$
ไม่มีความคิดเห็น:
แสดงความคิดเห็น