# Assignment - Device Plugin ###### tags: `Assignment`, `Device Plugin` ## Outline You should read the [Nvidia Device Plugin](https://github.com/NVIDIA/k8s-device-plugin) & trace code :::info Version: nvidia/k8s-device-plugin:v0.7.0-rc.7-ubuntu16.04 ::: ## Problem Description 目標: 將目前node上的gpu個數虛擬成兩倍 假設現在`nvidia.com/gpu = 2`,請透過修改source code的方式將其變為`nvidia.com/gpu = 4` 確認正常運行  ``` $ kubectl logs -n kube-system ${POD_NAME} ```  並且請使用你修改好的device plugin測試 ```bash= $ kubectl apply -f pod2.yml ``` ```yaml= apiVersion: v1 kind: Pod metadata: name: pod1 spec: restartPolicy: OnFailure containers: - image: nvidia/cuda name: pod1-ctr command: ["sleep"] args: ["100000"] resources: limits: nvidia.com/gpu: 1 --- apiVersion: v1 kind: Pod metadata: name: pod2 spec: restartPolicy: OnFailure containers: - image: nvidia/cuda name: pod1-ctr command: ["sleep"] args: ["100000"] resources: limits: nvidia.com/gpu: 1 --- apiVersion: v1 kind: Pod metadata: name: pod3 spec: restartPolicy: OnFailure containers: - image: nvidia/cuda name: pod1-ctr command: ["sleep"] args: ["100000"] resources: limits: nvidia.com/gpu: 1 --- apiVersion: v1 kind: Pod metadata: name: pod4 spec: restartPolicy: OnFailure containers: - image: nvidia/cuda name: pod1-ctr command: ["sleep"] args: ["100000"] resources: limits: nvidia.com/gpu: 1 ```  ```bash= $ kubectl apply -f pod2.yaml ``` ```yaml apiVersion: v1 kind: Pod metadata: name: podtwo spec: restartPolicy: OnFailure containers: - image: nvidia/cuda name: pod1-ctr command: ["sleep"] args: ["100000"] resources: limits: nvidia.com/gpu: 2 ```  ## Reference + Device Manager Proposal https://github.com/kubernetes/community/blob/master/contributors/design-proposals/resource-management/device-plugin.md + Kubernetes如何通過Device Plugins来使用NVIDIA GPU https://my.oschina.net/jxcdwangtao/blog/1793656 + NVIDIA/k8s-device-plugin源碼分析 https://www.twblogs.net/a/5c03de34bd9eee728baac89b
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up