diff --git a/templates/apps.yaml b/templates/apps.yaml index 4682a4c..304cf4d 100644 --- a/templates/apps.yaml +++ b/templates/apps.yaml @@ -88,6 +88,10 @@ spec: - name: {{ $name }} image: {{ $app.image }} imagePullPolicy: IfNotPresent + {{- if $app.gpu }} + securityContext: + privileged: true + {{- end }} ports: - name: http containerPort: {{ $app.port }} @@ -125,17 +129,15 @@ spec: - name: media mountPath: {{ $root.Values.media.mountPath }} {{- end }} - {{- /* gpu: request the iGPU from the Intel GPU device plugin (app intel-gpu-plugin - in apps-in-apps). It injects /dev/dri into the container, no privileged needed. */}} - {{- $res := deepCopy ($app.resources | default dict) }} - {{- if $app.gpu }} - {{- $_ := set $res "limits" (merge (dict "gpu.intel.com/i915" 1) (get $res "limits" | default dict)) }} - {{- end }} - {{- with $res }} + {{- if $app.gpu }} + - name: dri + mountPath: /dev/dri + {{- end }} + {{- with $app.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} - {{- if or $app.configPath $app.media }} + {{- if or $app.configPath $app.media $app.gpu }} volumes: {{- if $app.configPath }} - name: config @@ -148,6 +150,12 @@ spec: path: {{ $root.Values.media.hostPath }} type: DirectoryOrCreate {{- end }} + {{- if $app.gpu }} + - name: dri + hostPath: + path: /dev/dri + type: Directory + {{- end }} {{- end }} --- apiVersion: v1 diff --git a/values.yaml b/values.yaml index a40dcb3..c56e491 100644 --- a/values.yaml +++ b/values.yaml @@ -70,8 +70,9 @@ apps: configSize: 20Gi media: true ingress: true - # Intel QuickSync (UHD 630): requests gpu.intel.com/i915 from the Intel GPU device - # plugin (apps-in-apps: intel-gpu-plugin), which injects /dev/dri. Not privileged. + # Mounts /dev/dri for Intel QuickSync (UHD 630). Needs a privileged container, + # because the device cgroup blocks /dev/dri for unprivileged pods without a GPU + # device plugin. gpu: true ingressAnnotations: nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"