Post

Deploying Stremio on Kubernetes

Guide to deploying Stremio on a k3s Kubernetes cluster for personal media streaming.

Deploying Stremio on Kubernetes

Stremio is a popular media center application that allows users to organize and stream their media content. The goal of this guide is to deploy the Stremio Streaming Server on a Kubernetes cluster (k3s) in a reliable and secure manner.

This includes:

  • Running Stremio Server as a Kubernetes Deployment with persistent storage
  • Exposing it to users through a Traefik Ingress (k3s default) using a domain name
  • Securing communication with HTTPS using cert-manager and Let’s Encrypt This ensures the Stremio app, web client, and casting devices can communicate securely and without the “Failed to fetch” or “Cannot update casting device info” errors caused by missing SSL.

Cert-Manager Installation

  1. Install cert-manager

cert-manager automates the issuance and renewal of TLS certificates. Stremio clients and Chromecast require valid HTTPS connections as plain HTTP or self-signed certificates will cause playback failures. By integrating cert-manager with Let’s Encrypt, certificates are generated and renewed automatically, enabling seamless HTTPS access to the Stremio server.

1
2
3
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.crds.yaml
kubectl create namespace cert-manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml
  1. Create a ClusterIssuer A ClusterIssuer defines how cert-manager should obtain certificates.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    email: your-email@example.com
    server: https://acme-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: letsencrypt-prod
    solvers:
    - http01:
        ingress:
          class: traefik

DNS Configuration

Ensure your network has a DNS record pointing to your k3s cluster’s external IP address. This is necessary for Let’s Encrypt to validate domain ownership and issue certificates.

For my homelab setup, I used Adguard Home to manage DNS records. I created an A record using DNS Rewrites for stremio.yourdomain.net pointing to my cluster’s IP.

Stremio Deployment

Deploy the official stremio/server Docker image as a Kubernetes workload with persistence, auto-restart, and health monitoring.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: stremio-data-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: stremio-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: stremio
  template:
    metadata:
      labels:
        app: stremio
    spec:
      containers:
      - name: stremio
        image: stremio/server:latest
        ports:
        - containerPort: 11470
        env:
        - name: SERVER_PORT
          value: "11470"
        - name: NO_CORS
          value: "true"
        - name: LOG_LEVEL
          value: "info"
        volumeMounts:
        - name: stremio-data
          mountPath: /root/.stremio-server
        livenessProbe:
          httpGet:
            path: /stats.json
            port: 11470
          initialDelaySeconds: 10
          periodSeconds: 30
        readinessProbe:
          httpGet:
            path: /stats.json
            port: 11470
          initialDelaySeconds: 5
          periodSeconds: 15
      volumes:
      - name: stremio-data
        persistentVolumeClaim:
          claimName: stremio-data-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: stremio-service
spec:
  type: ClusterIP
  selector:
    app: stremio
  ports:
  - port: 11470
    targetPort: 11470

Ingress Configuration

Expose the Stremio service via Traefik Ingress with TLS.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: stremio-ingress
  annotations:
    kubernetes.io/ingress.class: traefik
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  tls:
  - hosts:
    - stremio.example.com
    secretName: stremio-tls
  rules:
  - host: stremio.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: stremio-service
            port:
              number: 11470

Accessing Stremio

Once everything is set up, access your Stremio server at https://stremio.yourdomain.net. You may still get a browser warning if the Stremio web client uses a self-signed certificate. However, the Stremio app and casting devices should connect without issues.

If you are using other devices like smart TVs, once you install the stremio app point it to your domain URL in the server settings.

This post is licensed under CC BY 4.0 by the author.