Portainer
Installation of Portainer. Serves as the web UI for docker container orchestration in my lab.
Prerequisites
Installation of Ubuntu (22.04) on PVE
Make sure to enable to Qemu agent on the System tab.
Enable NUMA in the CPU tab, if your platform supports it.
On the Disks tab, check the option discard if the VM is going to be a an SSD.
After the VM is created, just run through the Ubuntu server installer with the default settings.
Adding the iSCSI Drive
Go to Storage -> Pools
Click the three dots under a pool and select "add zvol"
Fill in the name and size of the zvol
Go to Sharing -> Block Shares (iSCSI)
Click on the wizard
Fill out the name of the share along with the device
I have not tested the performance of all the options under "Sharing Platform" but I generally use the "Modern OS" for iSCSI shares.
Select the default portal
Add the network address of the PVE host along with the CIDR mask
Confirm
Go to Datacenter -> Storage -> Add -> iSCSI
Enter a name for the ID, the IP of the TrueNAS host for the portal, and select the right target.
Go to the Ubuntu VM -> Hardware -> Add -> Hard Disk
Select the ID you created earlier for the Storage field
Choose LUN 0 for the disk image
Format and Mount the drive
fdisk -l
Use fdisk to list all the available devices
fdisk /dev/sdb
Select the disk
Use the option n
to create a new partition
I just used all the default values given by fdisk to create the
partition (primary, partition 1, default first and last sector
Use the option w
to write the new partition
mkfs.ext4 /dev/sdb1
Use mkfs to format the drive to ext4
mkdir /mnt/data
Run the line above to create a empty directory that the drive will mount to
/dev/sdb1 /mnt/data ext4 defaults 0 0
Append the line able to /etc/fstab
to automatically mount
the drive on boot
mount /mnt/data
Run that line to mount the partition
Docker Installation
Credit goes to the docker docs
Definitely bad practice to blindly copy-paste commands into shell, however im lazy and trust them enough
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Installation
Docker Compose:
version: "3"
services:
portainer:
image: portainer/portainer-ce:latest
ports:
- 9443:9443
volumes:
- /mnt/excontainervols/portainer:/data
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
Paste into "portainer.yml"
Execute with docker compose -f portainer.yml up -d
Usage
My main usage of Portainer is to have a web interface for docker containers.
On intialization, it will ask for a username and password.
Connect to local
To deploy most services listed in my lab, you can use the stacks option in Portainer, which is essentially equivalent to docker compose.