【问题标题】:Azure Devops pipeline unable to connect to AKS clusterAzure Devops 管道无法连接到 AKS 群集
【发布时间】:2021-11-17 07:51:39
【问题描述】:

我在 Azure Devops 中使用 ARM 服务连接,使用下面的 Devops 管道将掌舵图部署到 AKS。

- stage: Dev_Deployment
  displayName: "Deploy to Dev"
  jobs:
  - job: Deploy_to_AKS
    displayName: "Build, scan, and push the Docker image"
    steps:
    - task: HelmDeploy@0
      inputs:
        connectionType: 'Azure Resource Manager'
        azureSubscription: 'xxxxxxxxxxxxxxx'
        azureResourceGroup: 'xxxxxxxxxxx'
        kubernetesCluster: 'aks-cluster'
        useClusterAdmin: true
        namespace: 'dev'
        command: 'upgrade'
        chartType: 'Name'
        chartName: 'xxxx/xxxxxx'
        valueFile: 'devops/helmvalues.yaml'
        arguments: '--debug'

但是当管道尝试部署到集群时,我收到如下错误:

2021-09-23T06:06:33.2448376Z ##[section]开始:HelmDeploy 2021-09-23T06:06:33.2461242Z ==================================================== ============================ 2021-09-23T06:06:33.2461562Z 任务:打包和部署 Helm 图表 2021-09-23T06:06:33.2461921Z 描述:部署、配置、 通过运行 helm 更新 Azure 容器服务中的 Kubernetes 集群 命令 2021-09-23T06:06:33.2462221Z 版本:0.183.0 2021-09-23T06:06:33.2462445Z 作者:微软公司 2021-09-23T06:06:33.2462691Z 帮助: https://aka.ms/azpipes-helm-tsg2021-09-23T06:06:33.2462992Z ==================================================== ============================= 2021-09-23T06:06:34.0152308Z [命令]/usr/local/bin/helm upgrade --namespace dev --install --values /home/vsts/work/1/s/devops/helmvalues.yaml --wait --debug 20210923.3 xxxxxxx 2021-09-23T06:06:38.3572124Z 错误:Kubernetes 集群 无法访问:获取“xxxxxxx”:拨号 tcp:在 xxxxxxx 上查找 xxxxxxx:否 这样的主机 2021-09-23T06:06:38.3585227Z helm.go:81: [debug] 获取 "xxxxxxx": dial tcp: lookup xxxxxxx on xxxxxxx: no such host 2021-09-23T06:06:38.3586699Z Kubernetes 集群无法访问 2021-09-23T06:06:38.3587230Z helm.sh/helm/v3/pkg/kube.(*Client).IsReachable 2021-09-23T06:06:38.3587833Z helm.sh/helm/v3/pkg/kube/client.go:115 2021-09-23T06:06:38.3588341Z helm.sh/helm/v3/pkg/action.(*History).Run 2021-09-23T06:06:38.3588862Z helm.sh/helm/v3/pkg/action/history.go:48 2021-09-23T06:06:38.3589375Z main.newUpgradeCmd.func2 2021-09-23T06:06:38.3589878Z helm.sh/helm/v3/cmd/helm/upgrade.go:93 2021-09-23T06:06:38.3590399Z github.com/spf13/cobra.(*Command).execute 2021-09-23T06:06:38.3591896Z github.com/spf13/cobra@v1.1.3/command.go:852 2021-09-23T06:06:38.3592781Z github.com/spf13/cobra.(*Command).ExecuteC 2021-09-23T06:06:38.3611885Z github.com/spf13/cobra@v1.1.3/command.go:960 2021-09-23T06:06:38.3614477Z github.com/spf13/cobra.(*Command).Execute 2021-09-23T06:06:38.3616752Z github.com/spf13/cobra@v1.1.3/command.go:897 2021-09-23T06:06:38.3617159Z main.main 2021-09-23T06:06:38.3617522Z helm.sh/helm/v3/cmd/helm/helm.go:80 2021-09-23T06:06:38.3617900Z runtime.main 2021-09-23T06:06:38.3618254Z runtime/proc.go:225 2021-09-23T06:06:38.3618598Z runtime.goexit 2021-09-23T06:06:38.3618966Z 运行时/asm_amd64.s:1371 2021-09-23T06:06:38.3676299Z ##[错误]错误:Kubernetes 集群 无法访问:获取“xxxxxxx”:拨号 tcp:在 xxxxxxx 上查找 xxxxxxx:否 这样的主机 helm.go:81: [debug] Get "xxxxxxx": dial tcp:lookup xxxxxxx on xxxxxxx: no such host Kubernetes cluster unreachable helm.sh/helm/v3/pkg/kube.(*Client).IsReachable helm.sh/helm/v3/pkg/kube/client.go:115 helm.sh/helm/v3/pkg/action.(*History).Run helm.sh/helm/v3/pkg/action/history.go:48 main.newUpgradeCmd.func2 helm.sh/helm/v3/cmd/helm/upgrade.go:93 github.com/spf13/cobra.(*Command).execute github.com/spf13/cobra@v1.1.3/command.go:852 github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra@v1.1.3/command.go:960 github.com/spf13/cobra.(*Command).Execute github.com/spf13/cobra@v1.1.3/command.go:897 main.main helm.sh/helm/v3/cmd/helm/helm.go:80 runtime.main runtime/proc.go:225 runtime.goexit runtime/asm_amd64.s:1371

2021-09-23T06:06:38.3696886Z ##[section]整理:HelmDeploy

我该如何解决这个问题? 编辑:更新错误

【问题讨论】:

  • 能否启用诊断设置,看看能否得到更详细的错误信息?
  • @Thomas 详细更新了错误。
  • 你能在本地机器上运行同样的命令吗?我们的 aks 集群网络是如何配置的?

标签: azure-devops kubernetes-helm azure-aks


【解决方案1】:

【讨论】:

  • 很高兴知道这个问题已经解决。我建议你可以接受这个答案。这将对其他用户有所帮助。
猜你喜欢
  • 2020-01-12
  • 2019-06-26
  • 1970-01-01
  • 1970-01-01
  • 2018-04-22
  • 2022-12-05
  • 2019-11-23
  • 2021-01-11
  • 2020-02-25
相关资源
最近更新 更多