DLNA server on kubernetes, embarassingly simple…

As the last step of migration to kubernetes I am migrating my DLNA server to kubernetes. This will allow me to play content from my server on my TV. As part of my previous migration of the NAS I already migrated over all my data (including media) to kubernetes so this should be easy: just run a DLNA server on kubernetes and give it a mount of the media content. This new setup is going to replace my old mediatomb setup.

A google search pointed me to a DLNA image that I could use. There is only one special thing about this setup which is that the DLNA server requires host mode networking. Otherwise it cannot be discovered automatically by the TV. With this in mind, the work involved in creating a deployment is nothing more than inspecting the docker command line for the image and translating it to a Deployment specification:

apiVersion: apps/v1
kind: Deployment
  name: dlna
  namespace: brakkee-org
  replicas: 1
      app: dlna-server
        app: dlna-server
      hostNetwork: true                                       # A
      terminationGracePeriodSeconds: 0                        # B 
        - name: dlna
          # C
          image: vladgh/minidlna@sha256:2db31fc03986a82bf097b900ebd8f2f801f4dcd2727979a91dbcba3a5a3c6f7e
            - containerPort: 8200
            - name: MINIDLNA_MEDIA_DIR
              value: /media
            - name: MINIDLNA_FRIENDLY_NAME
              value: MediaLibrary
            - name: dlna-data
              mountPath: /media
        - name: dlna-data
            claimName: dlna-data

  • # A: Host mode networking is selected here to allow discovery
  • # B: An optional setting that provides quicker shutdown of the container.
  • # C: The image does not appear to have fixed version tags, so I use the hash here to explicitly use a specified version (in general this is a good principle to follow for any image).

With this setup a Service does not need to be defined since host mode networking is used. Also, network policies cannot be used here since they do not cover host mode networking. A possible addition would be health checks but so far it appears to work without issues.

Final thoughts

I am amazed at how easy it was to setup. It worked on the first try and I did not even try it out first using docker. The only issue I encountered was that I used a DLNA image that was released 2 years ago instead of a more actively maintained one. So I had to change the setup afterwards to use another image with a slightly different setup.

This entry was posted in Devops/Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published.