【问题标题】:azure-devops pipeline:unable to recognize "/abc.yml": Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refusedazure-devops 管道:无法识别“/abc.yml”:获取 http://localhost:8080/api?timeout=32s:拨打 tcp 127.0.0.1:8080:连接:连接被拒绝
【发布时间】:2018-11-28 17:29:46
【问题描述】:

我正在尝试使用 Azure Devops 管道在 AKS 上部署我的服务。除了在 Kubernetes 服务上应用我的最新版本外,一切正常。我正在使用以下命令来部署服务。

#- script: docker build -f ./ContainerApp/Dockerfile -t $(dockerServer)/$(imageName) . 
#  displayName: 'Container Build'
#
#- script: docker login -u $(dockerId) -p $(dockerPassword) $(dockerServer)
#  displayName: 'Container Service login'
#
#- script: docker push $(dockerServer)/$(imageName)
#  displayName: 'Container Push'
#
    - script: kubectl apply -f ./azure-kubernetes-deployment.yml
      displayName: 'deploying to Kubernetes'

当我从本地计算机运行此命令时它工作正常,但在管道上不起作用。当我在管道上运行时发生以下错误。

谁能建议我缺少什么命令?

2018-11-28T14:19:09.6975888Z Generating script.
2018-11-28T14:19:09.6998755Z Script contents:
2018-11-28T14:19:09.6999302Z kubectl apply -f ./azure-kubernetes-deployment.yaml
2018-11-28T14:19:09.7032788Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/e571ec91-5ac4-4e17-8f48-cd0fd0877683.sh
2018-11-28T14:19:10.0021936Z unable to recognize "./azure-kubernetes-deployment.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
2018-11-28T14:19:10.0023429Z unable to recognize "./azure-kubernetes-deployment.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
2018-11-28T14:19:10.0162142Z ##[error]Bash exited with code '1'.
2018-11-28T14:19:10.0177080Z ##[section]Finishing: deploying to Kubernetes

【问题讨论】:

  • 路径相对于 $(System.DefaultWorkingDirectory)。你确定那是放置 azure-kubernetes-deployment.yaml 的地方吗?
  • @ColinB 我已经验证通过添加额外的脚本“ls -l”,它表明该脚本位于完美的位置。

标签: azure azure-devops azure-pipelines azure-pipelines-release-pipeline azure-aks


【解决方案1】:

我不知道在您的特定用例中出现这种情况的原因,但是

unable to recognize "...yaml": Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused

(一条相当无益且令人困惑的消息)表示未能联系到 Kubernetes 集群。

【讨论】:

    猜你喜欢
    • 2020-11-13
    • 2018-12-26
    • 2020-11-22
    • 2011-07-26
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 2019-06-21
    • 1970-01-01
    相关资源
    最近更新 更多