【发布时间】: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