Running a docker container which uses GPU from kubernetes fails to find the GPU

  docker, docker-compose, gpu, kubernetes

I want to run a docker container which uses GPU (it runs a cnn to detect objects on a video), and then run that container on kubernetes.
I can run the container from docker alone without problems, but when I try to run the container from kubernetes it fails to find the GPU.

I running it using this command:
kubectl exec -it namepod /bin/bash

This is the problem that I get:

kubectl exec -it tym-python-5bb7fcf76b-4c9z6 /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] — [COMMAND] instead.
[email protected]:/opt# cd servicio/
[email protected]:/opt/servicio# python3
Try to load cfg: /opt/darknet/cfg/yolov4.cfg, weights: /opt/yolov4.weights, clear = 0
CUDA status Error: file: ./src/dark_cuda.c : () : line: 620 : build time: Jul 30 2021 – 14:05:34

CUDA Error: no CUDA-capable device is detected
python3: check_error: Unknown error -1979678822
[email protected]:/opt/servicio#

Source: Docker Questions