Azure Devops MS托管的代理IP地址 [英] Azure Devops MS-hosted agent IP address

查看:56
本文介绍了Azure Devops MS托管的代理IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将Azure DevOps与Microsoft托管的代理一起使用,并且由于我们想为AKS应用授权的IP范围,因此需要代理IP地址.为了使发布管道中的过程自动化,我们在命令中包括了Azure CLI任务:

We use Azure DevOps with Microsoft-hosted agents, and because we would like to apply authorized IP ranges for our AKS we need the agent IP addresses. To automate the process in our release pipeline we have included Azure CLI task with the command :

AGENT_IP = $(curl -s https://ipinfo.io/json | jq -r .ip)

az aks更新--resource-group xxx --name yyy --api-server-authorized-ip-ranges $ {AGENT_IP}

我们从命令行获取的所有AGENT_IP均未在每周json文件中列出.即使操作已成功执行,并且AGENT_IP包含在"apiServerAccessProfile.authorizedIpRanges"部分中,有时我们也无法将微服务部署到AKS,并且出现错误:无法连接到服务器:拨打tcp xx.xx.xx.xx:443:I/O超时".但是,即使AGENT_IP不在每周json中列出,有时部署也会成功.

All the AGENT_IPs, we are getting from the command line, are not listed in the weekly json file. Even the operation is executed successfully and the AGENT_IP is included in the "apiServerAccessProfile.authorizedIpRanges" section, sometimes we are not able to deploy our microservice to the AKS and we are getting an error: "Unable to connect to the server: dial tcp xx.xx.xx.xx:443: i/o timeout". However sometimes the deployment is successful, even though the AGENT_IP is not listed in the weekly json.

为什么我获得的IP地址不在每周的json文件中?我可以随机部署到AKS吗?

Why the IP addresses I am getting, are not in the weekly json file ? Randomly I am able to deploy to AKS ?

推荐答案

请阅读以下文档:

我使用此脚本获得了IP地址:

I got IP address using this script:

Invoke-RestMethod -Uri ('http://ipinfo.io/'+(Invoke-WebRequest -uri "http://ifconfig.me/ip").Content)

对于构建管道,我得到的IP地址超出了 AzureCloud.westeurope 的每周文件的IP地址范围.(在我的情况下是168.63.69.117,137.135.240.152).但是对于不正常的管道,我得到的IP处于每周文件的IP范围内:

And for build pipelines I got IP address which was outside of any IP range from weekly file for AzureCloud.westeurope. (In my case it was 168.63.69.117, 137.135.240.152). However for relese pipeline I got IP which are in IP ranges from weekly file:

  • 52.157.67.128-IP范围52.157.64.0/18
  • 40.118.28.211-IP范围40.118.0.0/17

但是我注意到建筑代理商位于爱尔兰,这是北欧地区.是的,IP地址与来自北欧的IP范围相匹配:

But I noticed that build agents are located in Ireland and this is North Europe region. And yes, IP addresses matches IP ranges from North Europe:

  • 137.135.240.152-IP范围137.135.128.0/17
  • 168.63.69.117-IP范围168.63.64.0/20

我不知道为什么这样做会如此,因为我的设置中有西欧地区.

I have no idea why this works like that since I have West Europe region in my settings.

但总结一下:

  • 建立管道-北欧地区
  • 发布管道-西欧地区

这篇关于Azure Devops MS托管的代理IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆