Radarr is a fork of Sonarr that manages movies and movie collections in your library. It integrates with popular download clients such as QBittorrent, and indexers to search and downloading releases, and manage your media library by renaming files, updating metdata and more.
Radarr can be deployed to Kubernetes with Terraform using a Deployment
. In addition you will need a location on your node where the media is stored, and another where downloads are saved. Those will be used by Radarr as the root folder as well as the download folder for your download clients.
You can use NFS or SMB with network-attached storage so that Radarr can run on any node in a multi-node cluster. But for this example we'll use Rancher's local-path
provisioner to attach a host path.
The Terraform module seen below, can be configured to suit your needs, and then imported into your main module to deploy Radarr:
terraform {
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.13.1"
}
}
}
resource "kubernetes_deployment" "radarr" {
metadata {
name = "radarr"
namespace = var.namespace
labels = {
"servarr.app" = "radarr"
}
}
spec {
replicas = 1
selector {
match_labels = {
"servarr.app" = "radarr"
}
}
template {
metadata {
labels = {
"servarr.app" = "radarr"
}
}
spec {
container {
image = "lscr.io/linuxserver/radarr:4.2.4"
name = "radarr"
env {
name = "PUID"
value = 1000
}
env {
name = "PGID"
value = 1000
}
env_from {
config_map_ref {
name = kubernetes_config_map.radarr_env.metadata.0.name
}
}
port {
container_port = 7878
}
volume_mount {
name = "data"
mount_path = "/config"
}
volume_mount {
name = "movies"
mount_path = "/movies"
}
volume_mount {
name = "import"
mount_path = "/import"
}
volume_mount {
name = "downloads"
mount_path = "/downloads"
}
}
volume {
name = "data"
persistent_volume_claim {
claim_name = "radarr-data"
}
}
volume {
name = "movies"
host_path {
path = "/mnt/media/library/movies"
type = "Directory"
}
}
volume {
name = "import"
host_path {
path = "/mnt/media/library/import/movies"
type = "Directory"
}
}
volume {
name = "downloads"
host_path {
path = "/mnt/media/torrents/downloads"
type = "Directory"
}
}
}
}
}
}
resource "kubernetes_persistent_volume_claim" "radarr_data" {
metadata {
name = "radarr-data"
namespace = var.namespace
}
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "10Gi"
}
}
storage_class_name = "local-path"
}
}
resource "kubernetes_service" "radarr" {
metadata {
name = "radarr"
namespace = var.namespace
}
spec {
type = "LoadBalancer"
selector = {
"servarr.app" = "radarr"
}
port {
port = 7878
}
}
depends_on = [
kubernetes_deployment.radarr
]
}
resource "kubernetes_config_map" "radarr_env" {
metadata {
name = "radarr-env"
namespace = var.namespace
}
data = {
"TZ" = "Europe/Zurich"
}
}
By default the LoadBalancer
service type will expose port 7878 to the local network. You can use a Kubernetes Ingress or Traefik's Ingress CRD to expose the Radarr service with a public domain, and switch to a ClusterIP
service type to avoid exposing too many ports.
Making Radarr publicly accessible means anyone with your domain/hostname can access the application. Enable authentication in Radarr first, under Settings > General, enable Authencation with "Forms" and set a username and password.