k8s报错Error: template: nvidia-device-plugin/templates/gfd.yml:22:19: executing "nvidia-device-plugin/...

文章讲述了在安装k8s-device-plugin时遇到的错误,涉及到Helm版本过低和CustomResourceDefinition冲突。作者详细描述了升级Helm、处理CRD冲突以及重新安装NVIDIA设备插件的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

在安装 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 导入

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值