NTHU-LSALAB / KubeShare

Share GPU between Pods in Kubernetes
Apache License 2.0
193 stars 42 forks source link

How to mount a directory and enter the container to run python script? #8

Closed globalmaster closed 3 years ago

globalmaster commented 4 years ago

Hi, I want to mount a directory and enter the container to run python script. Below are the yaml of a pod3:

apiVersion: kubeshare.nthu/v1
kind: SharePod
metadata:
  name: pod3
  annotations:
    "kubeshare/gpu_request": "0.4"
    "kubeshare/gpu_limit": "1.0"
    "kubeshare/gpu_mem": "3145728000"
    "kubeshare/GPUID": "abcde"
spec:
  terminationGracePeriodSeconds: 0
  containers:
  - name: tf
    image: 10.166.15.29:5000/tensorflow/tensorflow:1.15.2-gpu-py3
    volumeMounts:
    - name: workspace
      mountPath: /benchmarks
    # command: ["sh", "-c", "python3 /root/benchmarks/scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py"]
    # command: ["sh", "-c", "curl -s https://lsalab.cs.nthu.edu.tw/~ericyeh/KubeShare/demo/mnist.py | python3 -"]
  nodeName: k8s-gpu
  # restartPolicy: OnFailure
  # restartPolicy: Always
  restartPolicy: Never
  volumes:
    - name: workspace
      hostPath:
        path: "/home/hezhiming/benchmarks/"

I run: kubectl create -f pod3.yaml then run: kubectl get pods The status of pod3 is Completed. I run: kubectl exec -it pod3 --container tf bash get this error: error: cannot exec into a container in a completed pod; current phase is Succeeded

How can I keep the status of pod3 running and enter the container to run python script?

jchou-git commented 3 years ago

sorry, but this issue seems to be unrelated to kubeshare.