我正在尝试使用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
答案 0 :(得分:-1)
在您的特定用例中,我不知道它的原因,但是
unable to recognize "...yaml": Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
(一条无助且令人困惑的消息)表示无法联系kubernetes集群。