Multicast config with streamer
Date: August 18, 2026
Namespace: cdn
Cluster: k3s, 4 nodes (castis-desktop, nuc-a, nuc-b control-plane; mac-mini worker)
1. Starting point / problem¶
Existing streamer Deployment had:
- hostNetwork: true (binds ports 18080/18081 directly on the node)
- nodeSelector: kubernetes.io/hostname: nuc-b (permanently pinned to one node)
- No persistent volume for runtime state
Goal: if the node running streamer goes down, the pod should reschedule to another node — without needing a full duplicate copy of its data volume per node.
2. Port conflict troubleshooting (hostNetwork)¶
Because of hostNetwork: true, "port already in use" errors mean something on the host itself (not just the cluster) already holds 18080/18081. Useful checks on the target node:
sudo ss -ltnp | grep -E ':18080|:18081'
sudo crictl ps -a | grep streamer
kubectl get pods -A -o wide | grep <node>
Common cause: a stale/terminating previous streamer pod on the same node holding the port, or a rollout race (see Section 5).
3. Storage decision: Longhorn over NFS¶
Two options considered: - NFS / shared RWX volume — simplest if streamer only reads static data; no replication needed since all nodes see the same files. - Longhorn (chosen) — streamer writes runtime state, so a networked block volume with managed replication was the better fit. Already installed in this cluster.
StorageClass (longhorn-streamer):
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: longhorn-streamer
provisioner: driver.longhorn.io
allowVolumeExpansion: true
reclaimPolicy: Retain
volumeBindingMode: Immediate
parameters:
numberOfReplicas: "2"
staleReplicaTimeout: "30"
numberOfReplicas: 2— one live copy on a different node than the pod, so a node failure doesn't lose data, without going to full per-node duplication.reclaimPolicy: Retain— deleting the PVC doesn't delete the underlying data; must be removed explicitly.
PVC (streamer-data, ReadWriteOnce, 10Gi) — one PVC total; Longhorn attaches/detaches it to whichever node the pod lands on. Not one PVC per node.
4. Deployment changes¶
- Removed
nodeSelector: kubernetes.io/hostname: nuc-b— this was the actual blocker preventing failover; as long as it's present the scheduler will never move the pod elsewhere. (Still need to confirm this is actually committed/applied — as of this session the live pod'sdescribeoutput still showed the oldnodeSelector.) - Added
volumeMounts/volumesreferencing PVCstreamer-data. - Known open item: mount path for streamer's actual runtime-data directory not yet confirmed — placeholder
/castis/bin/streamer/dataused, needs verifying against the real app config/docs.
5. Rollout deadlock: hostNetwork + RWO PVC¶
Default RollingUpdate strategy tries to start the new pod while the old one still holds both the host port and the volume attachment — classic deadlock for a singleton hostNetwork pod with an RWO volume. Symptoms seen: new pod stuck Pending/ContainerCreating, multiple ReplicaSets piling up.
Fix: switch strategy to Recreate so the old pod is fully torn down (releasing port + volume) before a new one is created:
Should be committed into the deployment yaml in playtelly-iac (not just patched live) so it survives future kubectl apply.
Debugging commands used when pods got stuck:
kubectl describe pod -n cdn <pod> # check Events for real cause
kubectl get rs -n cdn -l app=streamer # find duplicate/stale ReplicaSets
kubectl get volumeattachments.storage.k8s.io # check for stale Longhorn attachment
kubectl delete pod -n cdn <pod> --grace-period=0 --force # only for pods that never started
Root cause actually found for one stuck rollout: PVC name mismatch — Deployment referenced claimName: streamer-pvc, but the PVC that existed was named streamer-data. Not a scheduling/port/volume issue at all, just a typo/drift between the applied manifest and what was actually created. Fixed by aligning the claimName in the deployment yaml.
6. Open items going into next session¶
- Confirm
nodeSelectoris actually removed (or replaced with multi-nodenodeAffinity) in the committedplaytelly-iacmanifest — live cluster still showed the old single-node selector as of this session. - Confirm the real runtime-data mount path inside the streamer container (currently a placeholder).
- Confirm
strategy: Recreateis committed to the yaml file in the repo, not just patched live. - After a clean rollout, verify only one healthy
streamerpod exists (kubectl get pods -n cdn -l app=streamer) and that a forced node failure actually reschedules it with data intact (not yet tested end-to-end). - Separately: Ruijie switch port 2 was set to VLAN 2 access mode (
switchport mode access/switchport access vlan 2) — unrelated to the streamer work but done in the same session.