immich-app / immich-charts

Helm chart implementation of Immich
https://immich.app
GNU Affero General Public License v3.0
130 stars 53 forks source link

Support for GPU resources settings in Helm Chart to enable hardware transcoding #47

Closed lostz closed 12 months ago

lostz commented 1 year ago

It seems that there is no option available to configure GPU resources in the Helm chart. This lack of configurability prevents the leveraging of GPU resources for tasks such as video transcoding, which could greatly benefit from the parallel computing capabilities provided by GPUs.

PixelJonas commented 1 year ago

Hey lostz,

can you provide an example Manifest how you would like to configure the GPU resource?

SISheogorath commented 12 months ago

You can just configure GPU resources like any other resources:

# values.yaml
microservices:
  resources:
    requests:
      amd.com/gpu: "1"
      memory: 1Gi
      cpu: 500m
    limits:
      amd.com/gpu: "1"
      memory: 2Gi
      cpu: "1"

There shouldn't be any further setup needed.

PS: Make sure your cluster has the relevant resources installed and your GPU is actually compatible with immich: https://immich.app/docs/features/hardware-transcoding

RogerSik commented 10 months ago

How can i issue this with Intel Quick Sync?

With Plex i have mounted it as:

# extracted from kind: Deployment
      containers:
        - name: plex
          image: linuxserver/plex:1.32.8
          securityContext:
            privileged: true
          volumeMounts:
            # Intel Quick Sync
            - mountPath: /dev/dri/
              name: quicksync
      volumes:
        # Intel Quick Sync
        - name: quicksync
          hostPath:
            path: /dev/dri/
mike12806 commented 2 months ago

How can i issue this with Intel Quick Sync?

With Plex i have mounted it as:

# extracted from kind: Deployment
      containers:
        - name: plex
          image: linuxserver/plex:1.32.8
          securityContext:
            privileged: true
          volumeMounts:
            # Intel Quick Sync
            - mountPath: /dev/dri/
              name: quicksync
      volumes:
        # Intel Quick Sync
        - name: quicksync
          hostPath:
            path: /dev/dri/

Did you figure this out @RogerSik ?

RogerSik commented 2 months ago

How can i issue this with Intel Quick Sync? With Plex i have mounted it as:

# extracted from kind: Deployment
      containers:
        - name: plex
          image: linuxserver/plex:1.32.8
          securityContext:
            privileged: true
          volumeMounts:
            # Intel Quick Sync
            - mountPath: /dev/dri/
              name: quicksync
      volumes:
        # Intel Quick Sync
        - name: quicksync
          hostPath:
            path: /dev/dri/

Did you figure this out @RogerSik ?

Not really wit this helm chart.. My fix was to write my own manifest and there worked it with:

    spec:
      containers:
        - name: immich-server
          image: ghcr.io/immich-app/immich-server:v1.114.0 #
          securityContext:
            privileged: true # for intel quick sync
      nodeSelector:
        intel.feature.node.kubernetes.io/gpu: 'true'
mike12806 commented 2 months ago

How can i issue this with Intel Quick Sync? With Plex i have mounted it as:

# extracted from kind: Deployment
      containers:
        - name: plex
          image: linuxserver/plex:1.32.8
          securityContext:
            privileged: true
          volumeMounts:
            # Intel Quick Sync
            - mountPath: /dev/dri/
              name: quicksync
      volumes:
        # Intel Quick Sync
        - name: quicksync
          hostPath:
            path: /dev/dri/

Did you figure this out @RogerSik ?

Not really wit this helm chart.. My fix was to write my own manifest and there worked it with:

    spec:
      containers:
        - name: immich-server
          image: ghcr.io/immich-app/immich-server:v1.114.0 #
          securityContext:
            privileged: true # for intel quick sync
      nodeSelector:
        intel.feature.node.kubernetes.io/gpu: 'true'

@RogerSik any chance you'd be willing to share your deployment? Are you using NVIDIA?

RogerSik commented 2 months ago

@mike12806 sure here. It is written as DaemonSet, because i want to have it on every my nucs for high availability. But you can easily convert it to Deployment with ChatGPT.

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: immich-server
  namespace: immich
  annotations:
    reloader.stakater.com/auto: 'true'
  labels:
    app: immich-server
spec:
  selector:
    matchLabels:
      app: immich-server
  template:
    metadata:
      labels:
        app: immich-server
    spec:
      automountServiceAccountToken: false
      containers:
        - name: immich-server
          image: ghcr.io/immich-app/immich-server:v1.114.0 # {"$imagepolicy": "flux-system:immich-server"}
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              memory: 20Gi
            requests:
              memory: 2Gi
              cpu: 250m
          env:
            - name: DB_HOSTNAME
              valueFrom:
                secretKeyRef:
                  name: immich-db-app
                  key: host
                  optional: false
            - name: DB_DATABASE_NAME
              valueFrom:
                secretKeyRef:
                  name: immich-db-app
                  key: dbname
                  optional: false
            - name: DB_USERNAME
              valueFrom:
                secretKeyRef:
                  name: immich-db-app
                  key: username
                  optional: false
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: immich-db-app
                  key: password
                  optional: false
          envFrom:
            - configMapRef:
                name: immich
                optional: false
          livenessProbe:
            httpGet:
              path: /api/server-info/ping
              port: 3001
            failureThreshold: 6
            initialDelaySeconds: 60
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /api/server-info/ping
              port: 3001
            failureThreshold: 6
            periodSeconds: 10
          securityContext:
            privileged: true # for intel quick sync
          volumeMounts:
            - name: immich-ssd
              mountPath: /usr/src/app/upload/
            - name: immich-hdd-upload
              mountPath: /usr/src/app/upload/upload/
      nodeSelector:
        intel.feature.node.kubernetes.io/gpu: 'true'
      volumes:
        - name: immich-ssd
          nfs:
            server: '192.168.0.10'
            path: /volume1/immich/data/
        - name: immich-hdd-upload
          nfs:
            server: '192.168.0.10'
            path: /volume2/immich-hdd/data/upload/