k8s报错Error: template: nvidia-device-plugin/templates/gfd.yml:22:19: executing "nvidia-device-plugin/templates/gfd.yml" at <.Subcharts.gfd>: nil pointer evaluating interface {}.gfd

前言

在安装 kubernetes 插件 k8s-device-plugin时,报错:

复制代码
Error: template: nvidia-device-plugin/templates/gfd.yml:22:19: executing "nvidia-device-plugin/templates/gfd.yml" at <.Subcharts.gfd>: nil pointer evaluating interface {}.gfd

解决

通过查看 helm 发行文档,发现 helm 版本,至少需要 3.7.0 才能使用定义的子图。

https://github.com/helm/helm/releases/tag/v3.7.0

所以需要升级 helm,https://helm.sh/zh/docs/intro/install/

复制代码
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm

打印 helm 版本

复制代码
# helm version
version.BuildInfo{Version:"v3.14.0", GitCommit:"3fc9f4b2638e76f26739cd77c7017139be81d0ea", GitTreeState:"clean", GoVersion:"go1.21.5"}

helm 安装 nvidia-device-plugin

复制代码
helm upgrade -i nvdp nvdp/nvidia-device-plugin \
    --version=0.13.0 \
    --namespace kube-system \
    --set gfd.enabled=true \
    --set-file config.map.config=timesharing.yaml

又遇到以下问题:

复制代码
Error: unable to continue with install: CustomResourceDefinition "nodefeaturerules.nfd.k8s-sigs.io" in namespace an exists a nd cannot be imported into the current release : invalid ownership metadata; label validation error: missing key "app.kube rne tes.io/managed-by":must be set to "Helm" ; annotation validation error: missing key "meta.helm.sh/ release-name " :must be set to "nvdp";annotation validation error: missing key "meta.helm. sh/ release-namespace": must be set to "kube-system"

这是因为 CustomResourceDefinition "nodefeaturerules.nfd.k8s-sigs.io" in namespace "an" exists and cannot be imported into the current release: 此错误表示在当前发布中无法导入已存在的自定义资源定义(CustomResourceDefinition)。可能是由于之前未正确删除该自定义资源定义而导致的冲突。

需要手动删除,已存在的自定义资源定义

复制代码
kubectl delete crd nodefeaturerules.nfd.k8s-sigs.io

重新安装nvidia-device-plugin

复制代码
helm upgrade -i nvdp nvdp/nvidia-device-plugin \
    --version=0.13.0 \
    --namespace kube-system \
    --set gfd.enabled=true \
    --set-file config.map.config=timesharing.yaml

安装成功

复制代码
Release "nvdp" does not exist. Installing it now.

NAME: nvdp
LAST DEPLOYED: Tue Jan 30 14:52:17 2024
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None

通过命令kubectl get pod -n kube-system查看,如果pod状态为ImagePullBackOff,这时还需要 docker 手动下载下来,docker load 导入

posted @   牛奔  阅读(75)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
历史上的今天:
2022-01-30 mac、windows 配置python国内镜像源
点击右上角即可分享
微信分享提示