Skip to content

Commit 3dc19ac

Browse files
Add nvidia-driver-installer and nvidia-gpu-device-plugin addons.
1 parent 3346b17 commit 3dc19ac

File tree

4 files changed

+169
-0
lines changed

4 files changed

+169
-0
lines changed

cmd/minikube/cmd/config/config.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,18 @@ var settings = []Setting{
212212
validations: []setFn{IsValidAddon},
213213
callbacks: []setFn{EnableOrDisableAddon},
214214
},
215+
{
216+
name: "nvidia-driver-installer",
217+
set: SetBool,
218+
validations: []setFn{IsValidAddon},
219+
callbacks: []setFn{EnableOrDisableAddon},
220+
},
221+
{
222+
name: "nvidia-gpu-device-plugin",
223+
set: SetBool,
224+
validations: []setFn{IsValidAddon},
225+
callbacks: []setFn{EnableOrDisableAddon},
226+
},
215227
{
216228
name: "hyperv-virtual-switch",
217229
set: SetString,
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright 2018 The Kubernetes Authors All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# The Dockerfile and other source for this daemonset are in
16+
# https://github.com/GoogleCloudPlatform/container-engine-accelerators/tree/master/nvidia-driver-installer/minikube
17+
18+
apiVersion: apps/v1
19+
kind: DaemonSet
20+
metadata:
21+
name: nvidia-driver-installer
22+
namespace: kube-system
23+
labels:
24+
k8s-app: nvidia-driver-installer
25+
kubernetes.io/minikube-addons: nvidia-driver-installer
26+
addonmanager.kubernetes.io/mode: Reconcile
27+
spec:
28+
selector:
29+
matchLabels:
30+
k8s-app: nvidia-driver-installer
31+
updateStrategy:
32+
type: RollingUpdate
33+
template:
34+
metadata:
35+
labels:
36+
k8s-app: nvidia-driver-installer
37+
spec:
38+
tolerations:
39+
- key: "nvidia.com/gpu"
40+
effect: "NoSchedule"
41+
operator: "Exists"
42+
volumes:
43+
- name: dev
44+
hostPath:
45+
path: /dev
46+
- name: nvidia-install-dir-host
47+
hostPath:
48+
path: /home/kubernetes/bin/nvidia
49+
- name: root-mount
50+
hostPath:
51+
path: /
52+
initContainers:
53+
- image: k8s.gcr.io/minikube-nvidia-driver-installer@sha256:85cbeadb8bee62a96079823e81915955af0959063ff522ec01522e4edda28f33
54+
name: nvidia-driver-installer
55+
resources:
56+
requests:
57+
cpu: 0.15
58+
securityContext:
59+
privileged: true
60+
env:
61+
- name: NVIDIA_INSTALL_DIR_HOST
62+
value: /home/kubernetes/bin/nvidia
63+
- name: NVIDIA_INSTALL_DIR_CONTAINER
64+
value: /usr/local/nvidia
65+
- name: ROOT_MOUNT_DIR
66+
value: /root
67+
volumeMounts:
68+
- name: nvidia-install-dir-host
69+
mountPath: /usr/local/nvidia
70+
- name: dev
71+
mountPath: /dev
72+
- name: root-mount
73+
mountPath: /root
74+
containers:
75+
- image: "gcr.io/google-containers/pause:2.0"
76+
name: pause
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copyright 2018 The Kubernetes Authors All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: apps/v1
16+
kind: DaemonSet
17+
metadata:
18+
name: nvidia-gpu-device-plugin
19+
namespace: kube-system
20+
labels:
21+
k8s-app: nvidia-gpu-device-plugin
22+
kubernetes.io/minikube-addons: nvidia-gpu-device-plugin
23+
addonmanager.kubernetes.io/mode: Reconcile
24+
spec:
25+
selector:
26+
matchLabels:
27+
k8s-app: nvidia-gpu-device-plugin
28+
template:
29+
metadata:
30+
labels:
31+
k8s-app: nvidia-gpu-device-plugin
32+
annotations:
33+
scheduler.alpha.kubernetes.io/critical-pod: ''
34+
spec:
35+
priorityClassName: system-node-critical
36+
tolerations:
37+
- operator: "Exists"
38+
effect: "NoExecute"
39+
- operator: "Exists"
40+
effect: "NoSchedule"
41+
volumes:
42+
- name: device-plugin
43+
hostPath:
44+
path: /var/lib/kubelet/device-plugins
45+
- name: dev
46+
hostPath:
47+
path: /dev
48+
containers:
49+
- image: "k8s.gcr.io/nvidia-gpu-device-plugin@sha256:0842734032018be107fa2490c98156992911e3e1f2a21e059ff0105b07dd8e9e"
50+
command: ["/usr/bin/nvidia-gpu-device-plugin", "-logtostderr"]
51+
name: nvidia-gpu-device-plugin
52+
resources:
53+
requests:
54+
cpu: 50m
55+
memory: 10Mi
56+
limits:
57+
cpu: 50m
58+
memory: 10Mi
59+
securityContext:
60+
privileged: true
61+
volumeMounts:
62+
- name: device-plugin
63+
mountPath: /device-plugin
64+
- name: dev
65+
mountPath: /dev
66+
updateStrategy:
67+
type: RollingUpdate

pkg/minikube/assets/addons.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,20 @@ var Addons = map[string]*Addon{
257257
"freshpod-rc.yaml",
258258
"0640"),
259259
}, false, "freshpod"),
260+
"nvidia-driver-installer": NewAddon([]*BinDataAsset{
261+
NewBinDataAsset(
262+
"deploy/addons/gpu/nvidia-driver-installer.yaml",
263+
constants.AddonsPath,
264+
"nvidia-driver-installer.yaml",
265+
"0640"),
266+
}, false, "nvidia-driver-installer"),
267+
"nvidia-gpu-device-plugin": NewAddon([]*BinDataAsset{
268+
NewBinDataAsset(
269+
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml",
270+
constants.AddonsPath,
271+
"nvidia-gpu-device-plugin.yaml",
272+
"0640"),
273+
}, false, "nvidia-gpu-device-plugin"),
260274
}
261275

262276
func AddMinikubeDirAssets(assets *[]CopyableFile) error {

0 commit comments

Comments
 (0)