WireGuard Easy

VPN rootful 1 container
wg-easy ghcr.io/wg-easy/wg-easy:latest · 51820:51820, 51821:51821

Kubernetes YAML

apiVersion: v1
kind: Pod
metadata:
  name: wg-easy
  labels:
    app: wg-easy
spec:
  restartPolicy: Always
  containers:
  - name: wg-easy
    image: ghcr.io/wg-easy/wg-easy:latest
    imagePullPolicy: Always
    ports:
    - containerPort: 51820
      hostPort: 51820
    - containerPort: 51821
      hostPort: 51821
    env:
    - name: WG_HOST
      value: wt1HenU1XOQZa3Cx0d1T3A
    - name: PASSWORD_HASH
      value: wt1HenU1XOQZa3Cx0d1T3A
    - name: WG_PORT
      value: '51820'
    - name: WG_DEFAULT_DNS
      value: 1.1.1.1
    - name: WG_ALLOWED_IPS
      value: 0.0.0.0/0
    volumeMounts:
    - name: vol-0
      mountPath: /etc/wireguard
    securityContext:
      capabilities:
        add:
        - NET_ADMIN
        - SYS_MODULE
  volumes:
  - name: vol-0
    persistentVolumeClaim:
      claimName: wg-easy-data

Deployment Guide rootful

Operating System:
!

Prerequisite as root

Install Podman

apt update && apt install -y podman
1

Save the YAML file

sudo mkdir -p /etc/containers/
sudo nano /etc/containers/wg-easy.yaml
2

Test the pod (without systemd)

sudo podman play kube /etc/containers/wg-easy.yaml

# Status:
sudo podman pod ps && sudo podman ps

# Stop:
sudo podman play kube --down /etc/containers/wg-easy.yaml
3

Create Quadlet .kube file (systemd)

wg-easy.kube

          

Save to /etc/containers/systemd/:

sudo mkdir -p /etc/containers/systemd/
sudo nano /etc/containers/systemd/wg-easy.kube
4

Start systemd service (rootful)

sudo systemctl daemon-reload
sudo systemctl start wg-easy.service
5

Status & Logs

sudo systemctl status wg-easy.service
sudo journalctl -u wg-easy.service -f
sudo podman pod ps
sudo podman ps
6

Enable automatic image updates optional

Requires AutoUpdate=registry in the .kube file. Podman checks for new images and restarts the pod automatically:

sudo systemctl enable --now podman-auto-update.timer

# Check status:
sudo systemctl status podman-auto-update.timer

# Trigger manually:
sudo podman auto-update
Rootful mode:
  • Containers run as root — only use trusted images
  • Ports < 1024 can be bound directly
  • No loginctl enable-linger needed — systemd manages the service
  • Quadlet path: /etc/containers/systemd/ (not ~/.config/)

Ports < 1024 (e.g. 80, 443)

Rootless cannot open privileged ports. Solution:

sysctl net.ipv4.ip_unprivileged_port_start=80

Make persistent in /etc/sysctl.d/99-podman.conf.

Containers communicate via localhost

All containers in the pod share the same network namespace. Always use localhost, not container names.

# Correct (e.g. app → db):
localhost:5432

# Wrong (doesn't work in a pod):
db-container:5432

List open ports

Which ports is the running pod listening on?

podman port wg-easy-pod

Custom DNS for the pod

Set a custom DNS server (e.g. local Pi-hole):

# In YAML under spec.dnsConfig:
spec:
  dnsConfig:
    nameservers:
      - 192.168.1.x

Set volume ownership

Fix permission errors by adjusting UID/GID in the user namespace:

podman unshare chown 1000:1000 /path/to/volume

SELinux volume labels

On SELinux systems (RHEL, Fedora) set the volume suffix:

/host/path:/container/path:Z   # private
/host/path:/container/path:z   # shared

List all volumes

podman volume ls
podman volume inspect <volume-name>

Volume backup

Back up data from a named volume:

podman run --rm \
  -v <volume-name>:/data:ro \
  -v $(pwd):/backup \
  busybox tar czf /backup/backup.tar.gz /data

Cleanup

Remove unused images, containers and volumes:

podman system prune -f        # containers + images
podman image prune -f         # untagged images only
podman volume prune -f        # unused volumes

Manual update

Pull a new image version and restart the pod:

podman pull <image>:<tag>
podman play kube --replace \
  ~/.config/containers/wg-easy.yaml

Check for outdated images

List local images and test auto-update without applying:

podman images
podman auto-update --dry-run

Shell into a running container

podman exec -it wg-easy-<container> /bin/sh
# or bash:
podman exec -it wg-easy-<container> /bin/bash

Follow live logs

# All containers in the pod:
podman pod logs -f wg-easy-pod

# Single container:
podman logs -f wg-easy-<container>

Pod info & resource usage

podman pod inspect wg-easy-pod
podman stats wg-easy-pod

Restart pod without data loss

podman pod restart wg-easy-pod

# or via systemd:
systemctl --user restart wg-easy.service

Stop & remove pod

sudo podman pod stop wg-easy-pod
sudo podman pod rm wg-easy-pod

All in one

sudo podman pod stop wg-easy-pod && sudo podman pod rm wg-easy-pod

Customize this stack
Change ports, volumes, environment variables and more in the generator.
Open in Generator