繁体   English   中英

azure 使用自托管代理的 devops:无法部署到 aks 集群

[英]azure devops with self Hosted agent : can't deploy to aks cluster

我想创建 azure devops 发布管道,构建 docker 图像并将其部署到 aks 集群。

对 acr 的构建和部署运行良好,但对 aks 的部署不起作用。

这是运行管道后的结果:

在此处输入图像描述

这是错误日志:

2023-01-08T22:20:48.7666031Z ##[section]Starting: deploy
2023-01-08T22:20:48.7737773Z ==============================================================================
2023-01-08T22:20:48.7741356Z Task         : Deploy to Kubernetes
2023-01-08T22:20:48.7745738Z Description  : Use Kubernetes manifest files to deploy to clusters or even bake the manifest files to be used for deployments using Helm charts
2023-01-08T22:20:48.7750005Z Version      : 0.212.0
2023-01-08T22:20:48.7752721Z Author       : Microsoft Corporation
2023-01-08T22:20:48.7755489Z Help         : https://aka.ms/azpipes-k8s-manifest-tsg
2023-01-08T22:20:48.7757618Z ==============================================================================
2023-01-08T22:20:49.2976400Z Downloading: https://storage.googleapis.com/kubernetes-release/release/stable.txt
2023-01-08T22:20:49.8627101Z Found tool in cache: kubectl 1.26.0 x64
2023-01-08T22:20:50.6940515Z ==============================================================================
2023-01-08T22:20:50.6942077Z            Kubectl Client Version: v1.26.0
2023-01-08T22:20:50.6943172Z            Kubectl Server Version: v1.23.12
2023-01-08T22:20:50.6944430Z ==============================================================================
2023-01-08T22:20:50.7161602Z [command]/azp/_work/_tool/kubectl/1.26.0/x64/kubectl apply -f /azp/_work/_temp/Deployment_acrdemo2ss-deployment_1673216450713,/azp/_work/_temp/Service_acrdemo2ss-loadbalancer-service_1673216450713 --namespace dev
2023-01-08T22:20:50.9679948Z Unable to connect to the server: dial tcp: lookup tfkcluster-dns-074e9373.hcp.canadacentral.azmk8s.io on 192.168.1.1:53: no such host
2023-01-08T22:20:50.9771688Z ##[error]Unable to connect to the server: dial tcp: lookup tfkcluster-dns-074e9373.hcp.canadacentral.azmk8s.io on 192.168.1.1:53: no such host
2023-01-08T22:20:50.9809463Z ##[section]Finishing: deploy

这是我的服务连接:

在此处输入图像描述

无法连接到服务器:拨打 tcp: lookup xxxx on 192.168.1.1:53: no such host

您似乎正在使用私有集群(创建 AKS 集群时启用了私有集群选项)。

在此处输入图像描述

Kubectl是一个 kube.netes 控制客户端。 它是连接 kube.netes 集群的外部连接提供者。 我们无法从外部连接到私有集群。

但是,我们无法在集群创建后禁用此选项。 我们需要删除集群并创建一个禁用“ Private Cluster ”选项的新集群。

或者,您可以设置另一个自托管代理,该代理与集群位于同一 .net 中,并且可以访问 AKS 和 Azure 管道。

请参阅连接到私有集群的选项

API 服务器端点没有公共 IP 地址。 若要管理 API 服务器,你需要使用可以访问 AKS 群集的 Azure 虚拟网络 (VNet) 的 VM。 有几个选项可用于建立与专用集群的网络连接。

  • 在与 AKS 群集相同的 Azure 虚拟网络 (VNet) 中创建 VM。
  • 在单独的网络中使用虚拟机并设置虚拟网络对等互连。 有关此选项的更多信息,请参阅下面的部分。
  • 使用 Express Route 或 VPN 连接。
  • 使用 AKS 命令调用功能。
  • 使用专用端点连接。

在与 AKS 群集相同的 .NET 中创建 VM 是最简单的选项。 Express Route 和 VPN 会增加成本并需要额外的网络复杂性。 Virtual.network peering 要求您规划您的 .network CIDR 范围以确保没有重叠范围。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM