apiVersion: apps/v1
kind: Deployment
metadata:
    namespace: media
    name: plex
    labels:
        app: plex
spec:
    replicas: 1
    selector:
        matchLabels:
            role: plex
    template:
        metadata:
            labels:
                role: plex
        spec:
            nodeSelector:
                kubernetes.io/hostname: amd64node4.lan
            containers:
            -   name: plex
                image: plexinc/pms-docker:plexpass
                imagePullPolicy: Always
                env:
                -   name: TZ
                    value: America/Chicago
                -   name: HOSTNAME
                    value: PlexServer
                -   name: ADVERTISE_IP
                    value: http://192.168.8.31:32400
                -   name: PLEX_UID
                    value: '1000'
                -   name: PLEX_GID
                    value: '1000'
                -   name: PLEX_CLAIM
                    value: claim-ixmFYNjPBiNVoWxY-9mT
                    # https://www.plex.tv/claim/
                livenessProbe:
                    tcpSocket:
                        port: 32400
                    initialDelaySeconds: 60
                    periodSeconds: 5
                ports:
                -   name: server
                    containerPort: 32400
                    protocol: TCP
                volumeMounts:
                -   name: media
                    mountPath: /data
                -   name: configuration
                    mountPath: /config
            volumes:
            -   name: media
                flexVolume:
                    driver: fstab/cifs
                    secretRef:
                        name: cifs-secret
                    options:
                        networkPath: //192.168.8.2/Storage/Media/
                        mountOptions: dir_mode=0755,file_mode=0644,noperm
            -   name: configuration
                hostPath:
                    path: /mnt/enclosure1_drive8/plex/config/
                    type: ''
