私有 AKS 无法找到本地文件的路径来通过 Helm 进行部署

问题描述 投票:0回答:2

我目前正在尝试通过我的私有 aks 集群部署我的 Helm Chart。但是,我无法执行任何操作,因为它找不到本地目录的路径。

这是我正在运行的命令:

az aks command invoke \
--resource-group aharo-aks-appgateway01 \
--name aharo-aks02 \
--command "helm install haro ./haro_files_helm_chart" 

这是我收到的错误消息

command started at 2023-01-06 22:49:46+00:00, finished at 2023-01-06 22:49:46+00:00 with exitcode=1
Error: INSTALLATION FAILED: path "./haro_files_helm_chart" not found

为了证明此类命令可以工作,我尝试了 Microsoft 文档中的一个命令:

az aks command invoke \   
--resource-group aharo-aks-appgateway01 \
--name aharo-aks02 \  
--command "helm repo add bitnami https://charts.bitnami.com/bitnami && helm repo update && helm install my-release bitnami/nginx"

我还能做什么来找到我的目录的路径?您知道我的集群上是否缺少任何配置吗?

azure kubernetes-helm azure-aks
2个回答
2
投票

当您将 helm install 命令传递到 AKS VM 时,VM(节点)将在其文件系统中查找

./haro_files_helm_chart
,而不是运行该命令的计算机,因此会出现路径未找到错误。

在您共享的示例中,节点正在安装首先下载的 Helm Chart。

要解决此问题,您应该附加带有

az aks command invoke
的 helm 图表目录,如 此处记录。以下是您需要的部分:

您还可以附加当前目录中的所有文件。例如:

az aks command invoke \
  --resource-group myResourceGroup \
  --name myAKSCluster \
  --command "kubectl apply -f deployment.yaml configmap.yaml -n default" \
  --file .

例如,我创建了一个名为“test-chart”的图表并使用

helm create test-chart
安装它。图表将在当前目录中创建:

$ls
test-chart

然后运行上面共享的相同命令,只需更改命令(不更改目录):

az aks command invoke \
  --resource-group myResourceGroup \
  --name myAKSCluster \
  --command "helm install test-chart-override-name test-chart" \
  --file .

0
投票

这个问题的答案如下:

az aks command invoke \
--resource-group aharo-aks-appgateway01 \
--name aharo-aks02 \
--command "helm install haro . " 

另一种解决方法是将 Helm Chart 上传到容器注册表,然后,您必须像 Microsoft 的示例一样下载并直接安装它们:

az aks command invoke \   
--resource-group aharo-aks-appgateway01 \
--name aharo-aks02 \  
--command "helm repo add bitnami https://charts.bitnami.com/bitnami && helm repo update && helm install my-release bitnami/nginx"

© www.soinside.com 2019 - 2024. All rights reserved.