簡體   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