Unmanic is an automation software to optimise your media library.
If you want to ensure your media is compatible with more clients you can use Unmanic to re-encode your media to H.264, or to save space H.265.
It also supports other features such as skipping ads, intros and more.
GitHub - Unmanic/unmanic: Unmanic - Library Optimiser
Unmanic can be deployed to Kubernetes using Terraform. You need to configure volumes with host paths to map your library folders to the Unmanic pod, and provision a PVC for its cache and data directories.
terraform {
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.13.1"
}
}
}
resource "kubernetes_deployment" "unmanic" {
metadata {
name = "unmanic"
namespace = var.namespace
labels = {
"servarr.app" = "unmanic"
}
}
spec {
replicas = 1
selector {
match_labels = {
"servarr.app" = "unmanic"
}
}
template {
metadata {
labels = {
"servarr.app" = "unmanic"
}
}
spec {
container {
image = "josh5/unmanic:latest"
name = "unmanic"
env_from {
config_map_ref {
name = kubernetes_config_map.unmanic_env.metadata.0.name
}
}
port {
container_port = 8888
}
volume_mount {
name = "data"
mount_path = "/config"
}
volume_mount {
name = "cache"
mount_path = "/tmp/unmanic"
}
volume_mount {
name = "movies"
mount_path = "/movies"
}
volume_mount {
name = "tv"
mount_path = "/tv"
}
resources {
requests = {
cpu = 2
}
limits = {
cpu = 4
}
}
}
volume {
name = "data"
persistent_volume_claim {
claim_name = "unmanic-data"
}
}
volume {
name = "cache"
persistent_volume_claim {
claim_name = "unmanic-cache"
}
}
volume {
name = "movies"
host_path {
path = "/mnt/media/library/movies"
type = "Directory"
}
}
volume {
name = "tv"
host_path {
path = "/mnt/media/library/tv"
type = "Directory"
}
}
}
}
}
}
resource "kubernetes_persistent_volume_claim" "unmanic_data" {
metadata {
name = "unmanic-data"
namespace = var.namespace
}
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "10Gi"
}
}
storage_class_name = "local-path"
}
}
resource "kubernetes_persistent_volume_claim" "unmanic_cache" {
metadata {
name = "unmanic-cache"
namespace = var.namespace
}
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "20Gi"
}
}
storage_class_name = "local-path"
}
}
resource "kubernetes_service" "unmanic" {
metadata {
name = "unmanic"
namespace = var.namespace
}
spec {
type = "LoadBalancer"
selector = {
"servarr.app" = "unmanic"
}
port {
port = 8888
}
}
depends_on = [
kubernetes_deployment.unmanic
]
}
resource "kubernetes_config_map" "unmanic_env" {
metadata {
name = "unmanic-env"
namespace = var.namespace
}
data = {
"PUID" = 1000
"PGID" = 1000
"TZ" = "Europe/Zurich"
}
}
Unmanic can be accessed on the internal network by using a LoadBalancer
service type which exposes port 8888
. If you want to expose Unmanic to the public via a domain, you can use Traefik, but since it doesn't support built-in authentication you should setup an authentication proxy using something like Authelia, or Traefik's built-in Basic auth.