Portainer

Installation of Portainer. Serves as the web UI for docker container orchestration in my lab.

Prerequisites

Installation of Ubuntu (22.04) on PVE

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

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

image.png

Go to Storage -> Pools

Click the three dots under a pool and select "add zvol"

image.png

Fill in the name and size of the zvol

image.png

Go to Sharing -> Block Shares (iSCSI)

Click on the wizard

image.png

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.

image.png

Select the default portal

image.png

Add the network address of the PVE host along with the CIDR mask

image.png

Confirm

image.png

Go to Datacenter -> Storage -> Add -> iSCSI

image.png

Enter a name for the ID, the IP of the TrueNAS host for the portal, and select the right target.

image.png

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.

image.png

Connect to local

image.png

To deploy most services listed in my lab, you can use the stacks option in Portainer, which is essentially equivalent to docker compose.