Remote LXD Management

radar23131st August 2021 at 10:37pm

References

Introduction

To allow for easier management of LXD containers on remote hosts, those remote hosts can be added to the local workstation.

Set-up of Remote Host

$ lxc config set core.https_address "[::]"
$ lxc config set core.trust_password (some-password)

Adding Remote Host

$ lxc remote add (some-name) <IP> 
  • This will prompt you to confirm the remote server fingerprint and then ask you for the password.

Usage Examples

  • listing LXD containers on remote host
$ lxc list starbug:

+-----------+---------+----------------------+------+-----------+-----------+
|   NAME    |  STATE  |         IPV4         | IPV6 |   TYPE    | SNAPSHOTS |
+-----------+---------+----------------------+------+-----------+-----------+
| delans    | RUNNING | 192.168.x.xx (eth0)  |      | CONTAINER | 0         |
+-----------+---------+----------------------+------+-----------+-----------+
| lxdmosaic | RUNNING | 192.168.x.xx (eth0)  |      | CONTAINER | 0         |
+-----------+---------+----------------------+------+-----------+-----------+
| nbtwiki   | RUNNING | 192.168.x.xxx (eth0) |      | CONTAINER | 0         |
+-----------+---------+----------------------+------+-----------+-----------+
| pihole1   | RUNNING | 192.168.x.xx (eth0)  |      | CONTAINER | 0         |
+-----------+---------+----------------------+------+-----------+-----------+
  • attaching to container on remote host
$ lxc exec starbug:delans bash

root@delans:~# 

....................
(created: 2021-06-10, last modified: 2021-08-31 at 22:37:42)