Skip to content

Commit 5fedf0e

Browse files
authored
Merge pull request #17516 from spowelljr/installNividaInKicbase
Kicbase: Install NVIDIA container toolkit during image build
2 parents 483ae12 + 4a38a1c commit 5fedf0e

File tree

13 files changed

+23
-47
lines changed

13 files changed

+23
-47
lines changed

cmd/minikube/cmd/start.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,9 @@ func validateGPUs(value, drvName, rtime string) error {
14561456
if value == "" {
14571457
return nil
14581458
}
1459+
if err := validateGPUsArch(); err != nil {
1460+
return err
1461+
}
14591462
if value != "nvidia" && value != "all" {
14601463
return errors.Errorf(`The gpus flag must be passed a value of "nvidia" or "all"`)
14611464
}
@@ -1465,6 +1468,14 @@ func validateGPUs(value, drvName, rtime string) error {
14651468
return errors.Errorf("The gpus flag can only be used with the docker driver and docker container-runtime")
14661469
}
14671470

1471+
func validateGPUsArch() error {
1472+
switch runtime.GOARCH {
1473+
case "amd64", "arm64", "ppc64le":
1474+
return nil
1475+
}
1476+
return errors.Errorf("The GPUs flag is only supported on amd64, arm64 & ppc64le, currently using %s", runtime.GOARCH)
1477+
}
1478+
14681479
func getContainerRuntime(old *config.ClusterConfig) string {
14691480
paramRuntime := viper.GetString(containerRuntime)
14701481

deploy/kicbase/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/
210210
apt-key add - < Release.key && \
211211
clean-install cri-o cri-o-runc; fi
212212

213+
# install NVIDIA container toolkit
214+
RUN export ARCH=$(dpkg --print-architecture) && \
215+
if [ "$ARCH" = 'amd64' ] || [ "$ARCH" = 'arm64' ] || [ "$ARCH" = 'ppc64el' ]; then \
216+
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && \
217+
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
218+
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
219+
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \
220+
clean-install nvidia-container-toolkit; fi
221+
213222
# install version.json
214223
ARG VERSION_JSON
215224
RUN echo "${VERSION_JSON}" > /version.json

pkg/drivers/kic/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import (
2424

2525
const (
2626
// Version is the current version of kic
27-
Version = "v0.0.41-1698773672-17486"
27+
Version = "v0.0.41-1698881667-17516"
2828

2929
// SHA of the kic base image
30-
baseImageSHA = "a46d6433f6f7543af472f7b8b305faa2da36b546834792a3c1a481f02ce07458"
30+
baseImageSHA = "966390c8d9b756c6e7044095f0ca5e5551da4c170cb501439eea24d1ad19bb89"
3131
// The name of the GCR kicbase repository
3232
gcrRepo = "gcr.io/k8s-minikube/kicbase-builds"
3333
// The name of the Dockerhub kicbase repository

pkg/minikube/cruntime/docker.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
"k8s.io/minikube/pkg/minikube/docker"
4040
"k8s.io/minikube/pkg/minikube/download"
4141
"k8s.io/minikube/pkg/minikube/image"
42-
"k8s.io/minikube/pkg/minikube/out"
4342
"k8s.io/minikube/pkg/minikube/style"
4443
"k8s.io/minikube/pkg/minikube/sysinit"
4544
)
@@ -568,9 +567,6 @@ func (r *Docker) configureDocker(driver string) error {
568567
StorageDriver: "overlay2",
569568
}
570569
if r.GPUs {
571-
if err := r.installNvidiaContainerToolkit(); err != nil {
572-
return fmt.Errorf("failed installing the NVIDIA Container Toolkit: %v", err)
573-
}
574570
assets.Addons["nvidia-device-plugin"].EnableByDefault()
575571
daemonConfig.DefaultRuntime = "nvidia"
576572
runtimes := &dockerDaemonRuntimes{}
@@ -585,30 +581,6 @@ func (r *Docker) configureDocker(driver string) error {
585581
return r.Runner.Copy(ma)
586582
}
587583

588-
// installNvidiaContainerToolkit installs the NVIDIA Container Toolkit
589-
// https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
590-
func (r *Docker) installNvidiaContainerToolkit() error {
591-
out.Styled(style.Warning, "Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose")
592-
if _, err := r.Runner.RunCmd(exec.Command("dpkg", "-l", "nvidia-container-toolkit")); err == nil {
593-
klog.Info("nvidia-container-toolkit is already installed, skipping install")
594-
return nil
595-
}
596-
out.Styled(style.Toolkit, "Installing the NVIDIA Container Toolkit...")
597-
cmds := []string{
598-
"curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg",
599-
"curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list",
600-
"sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit",
601-
}
602-
603-
for _, cmd := range cmds {
604-
c := exec.Command("/bin/bash", "-c", cmd)
605-
if _, err := r.Runner.RunCmd(c); err != nil {
606-
return err
607-
}
608-
}
609-
return nil
610-
}
611-
612584
// Preload preloads docker with k8s images:
613585
// 1. Copy over the preloaded tarball into the VM
614586
// 2. Extract the preloaded tarball to the correct directory

site/content/en/docs/commands/start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ minikube start [flags]
2727
--apiserver-port int The apiserver listening port (default 8443)
2828
--auto-pause-interval duration Duration of inactivity before the minikube VM is paused (default 1m0s). To disable, set to 0s (default 1m0s)
2929
--auto-update-drivers If set, automatically updates drivers to the latest version. Defaults to true. (default true)
30-
--base-image string The base image to use for docker/podman drivers. Intended for local development. (default "gcr.io/k8s-minikube/kicbase-builds:v0.0.41-1698773672-17486@sha256:a46d6433f6f7543af472f7b8b305faa2da36b546834792a3c1a481f02ce07458")
30+
--base-image string The base image to use for docker/podman drivers. Intended for local development. (default "gcr.io/k8s-minikube/kicbase-builds:v0.0.41-1698881667-17516@sha256:966390c8d9b756c6e7044095f0ca5e5551da4c170cb501439eea24d1ad19bb89")
3131
--binary-mirror string Location to fetch kubectl, kubelet, & kubeadm binaries from.
3232
--cache-images If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none. (default true)
3333
--cert-expiration duration Duration until minikube certificate expiration, defaults to three years (26280h). (default 26280h0m0s)

translations/de.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@
389389
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "Unsichere Docker-Registrys, die an den Docker-Daemon übergeben werden. Der CIDR-Bereich des Standarddienstes wird automatisch hinzugefügt.",
390390
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "Installieren Sie VirtualBox und stellen Sie sicher, dass es im Pfad ist. Alternativ verwenden Sie einen anderen --driver",
391391
"Install the latest hyperkit binary, and run 'minikube delete'": "Installieren Sie das aktuellste hyperkit-Binary und führen Sie 'minikube delete' aus",
392-
"Installing the NVIDIA Container Toolkit...": "",
393392
"Invalid port": "Falscher Port",
394393
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "Istio benötigt {{.minCPUs}} CPUs -- Ihre Konfiguration reserviert nur {{.cpus}} CPUs",
395394
"Istio needs {{.minMem}}MB of memory -- your configuration only allocates {{.memory}}MB": "Istio benötigt {{.minMem}}MB Speicher -- Ihre Konfiguration reserviert nur {{.memory}}MB",
@@ -884,7 +883,6 @@
884883
"User name must be 60 chars or less.": "Der Benutzername kann 60 oder weniger Zeichen lang sein",
885884
"Userspace file server is shutdown": "Userspace File Server ist heruntergefahren",
886885
"Userspace file server: ": "Userspace File Server:",
887-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
888886
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "",
889887
"Using Kubernetes {{.version}} since patch version was unspecified": "",
890888
"Using image repository {{.name}}": "Verwenden des Image-Repositorys {{.name}}",

translations/es.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@
395395
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "Registros de Docker que no son seguros y que se transferirán al daemon de Docker. Se añadirá automáticamente el intervalo CIDR de servicio predeterminado.",
396396
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "",
397397
"Install the latest hyperkit binary, and run 'minikube delete'": "",
398-
"Installing the NVIDIA Container Toolkit...": "",
399398
"Invalid port": "",
400399
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "",
401400
"Istio needs {{.minMem}}MB of memory -- your configuration only allocates {{.memory}}MB": "",
@@ -881,7 +880,6 @@
881880
"User name must be 60 chars or less.": "",
882881
"Userspace file server is shutdown": "",
883882
"Userspace file server: ": "",
884-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
885883
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "",
886884
"Using Kubernetes {{.version}} since patch version was unspecified": "",
887885
"Using image repository {{.name}}": "Utilizando el repositorio de imágenes {{.name}}",

translations/ja.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@
368368
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "Docker デーモンに渡す安全でない Docker レジストリー。デフォルトのサービス CIDR 範囲が自動的に追加されます。",
369369
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "VritualBox をインストールして、VirtualBox がパス中にあることを確認するか、--driver に別の値を指定してください",
370370
"Install the latest hyperkit binary, and run 'minikube delete'": "最新の hyperkit バイナリーをインストールして、'minikube delete' を実行してください",
371-
"Installing the NVIDIA Container Toolkit...": "",
372371
"Invalid port": "無効なポート",
373372
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "Istio は {{.minCPUs}} 個の CPU を必要とします -- あなたの設定では {{.cpus}} 個の CPU しか割り当てていません",
374373
"Istio needs {{.minMem}}MB of memory -- your configuration only allocates {{.memory}}MB": "Istio は {{.minMem}}MB のメモリーを必要とします -- あなたの設定では、{{.memory}}MB しか割り当てていません",
@@ -829,7 +828,6 @@
829828
"User name must be 60 chars or less.": "ユーザー名は 60 文字以内でなければなりません。",
830829
"Userspace file server is shutdown": "ユーザースペースのファイルサーバーが停止しました",
831830
"Userspace file server: ": "ユーザースペースのファイルサーバー: ",
832-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
833831
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "Docker ランタイムで Kubernetes v1.24+ を使用するには、cri-docker をインストールする必要があります",
834832
"Using Kubernetes {{.version}} since patch version was unspecified": "",
835833
"Using image repository {{.name}}": "{{.name}} イメージリポジトリーを使用しています",

translations/ko.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@
407407
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "",
408408
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "",
409409
"Install the latest hyperkit binary, and run 'minikube delete'": "",
410-
"Installing the NVIDIA Container Toolkit...": "",
411410
"Invalid port": "",
412411
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "",
413412
"Istio needs {{.minMem}}MB of memory -- your configuration only allocates {{.memory}}MB": "",
@@ -878,7 +877,6 @@
878877
"User name must be 60 chars or less.": "",
879878
"Userspace file server is shutdown": "",
880879
"Userspace file server: ": "",
881-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
882880
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "",
883881
"Using Kubernetes {{.version}} since patch version was unspecified": "",
884882
"Using image repository {{.name}}": "",

translations/pl.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@
394394
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "",
395395
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "",
396396
"Install the latest hyperkit binary, and run 'minikube delete'": "",
397-
"Installing the NVIDIA Container Toolkit...": "",
398397
"Invalid port": "",
399398
"Invalid size passed in argument: {{.error}}": "Nieprawidłowy rozmiar przekazany w argumencie: {{.error}}",
400399
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "",
@@ -888,7 +887,6 @@
888887
"User name must be 60 chars or less.": "",
889888
"Userspace file server is shutdown": "",
890889
"Userspace file server: ": "",
891-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
892890
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "",
893891
"Using Kubernetes {{.version}} since patch version was unspecified": "",
894892
"Using image repository {{.name}}": "",

translations/ru.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@
360360
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "",
361361
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "",
362362
"Install the latest hyperkit binary, and run 'minikube delete'": "",
363-
"Installing the NVIDIA Container Toolkit...": "",
364363
"Invalid port": "",
365364
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "",
366365
"Istio needs {{.minMem}}MB of memory -- your configuration only allocates {{.memory}}MB": "",
@@ -814,7 +813,6 @@
814813
"User name must be 60 chars or less.": "",
815814
"Userspace file server is shutdown": "",
816815
"Userspace file server: ": "",
817-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
818816
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "",
819817
"Using Kubernetes {{.version}} since patch version was unspecified": "",
820818
"Using image repository {{.name}}": "",

translations/strings.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@
360360
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "",
361361
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "",
362362
"Install the latest hyperkit binary, and run 'minikube delete'": "",
363-
"Installing the NVIDIA Container Toolkit...": "",
364363
"Invalid port": "",
365364
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "",
366365
"Istio needs {{.minMem}}MB of memory -- your configuration only allocates {{.memory}}MB": "",
@@ -814,7 +813,6 @@
814813
"User name must be 60 chars or less.": "",
815814
"Userspace file server is shutdown": "",
816815
"Userspace file server: ": "",
817-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
818816
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "",
819817
"Using Kubernetes {{.version}} since patch version was unspecified": "",
820818
"Using image repository {{.name}}": "",

translations/zh-CN.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@
472472
"Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.": "传递给 Docker 守护进程的不安全 Docker 注册表。系统会自动添加默认服务 CIDR 范围。",
473473
"Install VirtualBox and ensure it is in the path, or select an alternative value for --driver": "安装 VirtualBox 并确保它在路径中,或选择一个替代的值作为 --driver。",
474474
"Install the latest hyperkit binary, and run 'minikube delete'": "安装最新的 hyperkit 二进制文件,然后运行 'minikube delete'",
475-
"Installing the NVIDIA Container Toolkit...": "",
476475
"Invalid port": "无效的端口",
477476
"Istio needs {{.minCPUs}} CPUs -- your configuration only allocates {{.cpus}} CPUs": "Istio 需要 {{.minCPUs}} 个CPU核心,但您的配置只分配了 {{.cpus}} 个CPU核心。",
478477
"Istio needs {{.minMem}}MB of memory -- your configuration only allocates {{.memory}}MB": "Istio 需要 {{.minMem}}MB 内存,而你的配置只分配了 {{.memory}}MB",
@@ -994,7 +993,6 @@
994993
"User name must be 60 chars or less.": "用户名必须为 60 个字符或更少。",
995994
"Userspace file server is shutdown": "",
996995
"Userspace file server: ": "",
997-
"Using GPUs with the Docker driver is experimental, if you experience any issues please report them at: https://github.com/kubernetes/minikube/issues/new/choose": "",
998996
"Using Kubernetes v1.24+ with the Docker runtime requires cri-docker to be installed": "",
999997
"Using Kubernetes {{.version}} since patch version was unspecified": "使用 Kubernetes {{.version}},因为未指定修补程序版本",
1000998
"Using image repository {{.name}}": "正在使用镜像存储库 {{.name}}",

0 commit comments

Comments
 (0)