【问题标题】:How to run yaml file from Azure cloud shell如何从 Azure 云外壳运行 yaml 文件
【发布时间】:2021-03-03 04:41:47
【问题描述】:

我使用 Azure CLI 在Azure Kubernetes Service (AKS) cluster 上创建了一个 Windows Server 容器。在尝试将我的 aspnet core 应用程序部署到 AKS 群集时,我被困在上述链接的 this step 上。我的Windows-10 硬盘上有sample.yaml 文件,需要使用以下命令在Azure cloud shell 中运行:

kubectl apply -f sample.yaml

问题:我可以将上面的sample.yaml 文件放在哪里,以便我可以在Azure Cloud Shell 中运行上面的命令?我假设它可能必须在我的 Azure 存储帐户中的某个位置,但它应该放在哪里以便上面的命令可以识别它的路径?目前它给出了一个预期的错误:the path "sample.yaml" does not exist

【问题讨论】:

  • 好吧,当你运行你提到的从当前目录中选择文件的命令时。您保留在其他地方,您必须提供相对或绝对路径
  • @VivekKumar 它也无法识别来自硬盘的relative or absolute path。似乎这些文件必须在 Azure 中的某个地方。

标签: azure azure-aks azure-cloud-shell azure-yaml-pipelines


【解决方案1】:

您可以在 Azure can shell 中使用 vinanocode sample.yaml 直接创建一个名为 sample.yaml 的文件,然后复制您的 YAML 定义。

例如,在 Azure Bash 中键入 code sample.yaml。它会打开一个sample.yaml 文件,然后复制 YMAL 内容并保存。该文件自动存储在您当前的工作路径/home/user

或者,您可以将 sample.yaml 从本地上传到 Azure 路径。

或者,您也可以将文件永久存储到 Azure 文件共享中。要查找 Azure 文件共享,可以键入 df 命令。

【讨论】:

  • 出色的工作。很好解释。你的指示奏效了。你的this 也帮助了我(谢谢)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多