設定步驟
- 設定 RemoteServer
- 其他 Login 方式
- 加 Remote Server
- Usage
設定 RemoteServer
# Tells LXD to bind all addresses on port 8443 (預設是 443 port)
lxc config set core.https_address "0.0.0.0"
# Set admin pw
lxc config set core.trust_password MYPW
其他 Login 方式
1) Adding trusted certificates to the server
client certificate is in the server’s trust store
# --type Type of certificate (default "client")
lxc config trust add <file> # 在 remote server 上執行
2) Adding client certificates using a trust password
lxc config set core.trust_password MYPW
3) Adding client certificates using tokens (一次性的 pw)
此方法比用 core.trust_password 好, 因為 Token 會過期
lxc config trust add [--name ClientName]
--type Type of certificate (default "client")
Checking
lxc config trust list-tokens
| NAME | TOKEN | EXPIRES AT |
設定過期時間(1 month)
# 當 token 被使用後亦會被刪除
lxc config set core.remote_token_expiry 1m
P.S.
lxc config trust revoke-token NAME
List Trust
lxc config trust list
P.S.
lxc config trust remove NAME
加 Remote Server
lxc remote add RemoteName IP [--password=?]
[1]
Certificate fingerprint: 4882... ok (y/n/[fingerprint])?
[2]
Admin password (or token) for RemoteServerName:
Notes
- /var/snap/lxd/common/global-conf/ # Global (per-system)
- ~/snap/lxd/common/config/config.yml # Local (per-user)
i.e.
lxc remote add lxd-ii
cat ~/snap/lxd/common/config/config.yml
default-remote: local remotes: local: addr: unix:// public: false lxd-ii: addr: https://lxd-ii:8443 auth_type: tls project: default protocol: lxd public: false images: addr: https://images.linuxcontainers.org protocol: simplestreams public: true
預設remote那裡
lxc remote get-default
local
查看有什麼設定好的 remote server
# 預設有 images(Proto: simplestreams),local(Proto: lxd),ubuntu,ubuntu-daily
lxc remote list
P.S.
# On lxd-i
lxc list lxd-ii:
Error: not authorized
Remove
lxc remote remove NAME
Usage
# 查看在 Remote 的 Container
lxc list RemoteServerName:
# 有什麼 image
lxc image list RemoteServerName:
# 在 remote start VM
lxc launch clean-ubuntu RemoteServerName:fourth
# 進入 remote VM
lxc exec tryit:fourth bash
# Copy & Move
lxc copy RemoteServerName:fourth RemoteServerName:fifth
lxc move RemoteServerName:fifth sixth
Backup
lxd config
lxd init --dump