安装 Edge 服务
- 通过 Azure Portal:
- 登录 Azure Portal。
- 在左侧菜单中选择 + 创建资源。
- 选择 Edge,然后选择 Edge 部署。
- 配置所需的参数(如位置、虚拟机大小等),然后点击 部署。
- 通过 ARM 模板:
- 下载 Edge 部署 ARM 模板。
- 使用 Azure CLI 或其他工具将模板部署到 Azure。
配置 Edge 代理
-
通过 Azure Portal:
- 部署完成后,进入 Edge 的 资源页面。
- 在左侧菜单中选择 设置,然后选择 边缘计算。
- 配置 Ingress IP(内部和外部 IP)。
- 配置 Ingress 端口,设置需要的端口。
- 配置 Load Balancer,确保外部请求可以正确负载均衡到 Edge。
-
通过 Azure CLI:
az edge deployment create --deployment-edge-deployment --parameters edgeIngressIPInternal="10...1" --parameters edgeIngressIPExternal="10...2" --parameters edgeIngressPort="808"
配置 Edge 内部 DNS
- Edge 提供了内置的 DNS 解决方案,确保你的应用可以通过 DNS 名称访问服务。
- 通过 Azure Portal:
- 在 Edge 的 设置 中选择 DNS。
- 配置 Internal DNS Server 和 Internal DNS Domain。
- 添加需要解析的 DNS 记录。
配置 Edge 负载均衡
- Edge 支持 Azure Load Balancer 和 Azure Standard Load Balancer。
- 通过 Azure Portal:
- 在 Edge 的 设置 中选择 负载均衡。
- 配置所需的负载均衡规则,确保外部请求可以正确路由到 Edge。
- 配置 Health Probe(健康检查),确保应用服务健康时 Edge 才会接收请求。
配置 Edge 自签名证书
- 如果需要安全地配置 Edge,建议使用自签名证书。
- 通过 Azure Portal:
- 在 Edge 的 设置 中选择 证书。
- 添加自签名证书,配置 TLS 端口(如 8443)。
- 通过 Azure CLI:
az edge deployment update --deployment-edge-deployment --parameters edgeCertFile="your_cert.pem" --parameters edgePrivateKeyFile="your_key.pem"
配置 Edge 应用程序访问规则
- Edge 提供了丰富的路由规则,可以根据 IP 或路径路由到不同的应用。
- 通过 Azure Portal:
- 在 Edge 的 设置 中选择 路由。
- 添加路由规则,
- 源 IP 为 10.../24,路径为
/api/,路由到backendapp:80。 - 源 IP 为 ,路径为 ,路由到
backendapp:80。
- 源 IP 为 10.../24,路径为
- 通过 Azure CLI:
az edge deployment update --deployment-edge-deployment --parameters edgeRouteRootIP="10.../24" --parameters edgeRouteRootPath="/" --parameters edgeRouteBackendIP="backendapp:80"
集成 Edge 与 Azure AD
- 如果你需要通过 Azure Active Directory(Azure AD)管理 Edge 的访问控制,可以进行以下配置:
- 在 Edge 的 设置 中选择 访问控制。
- 配置 Azure AD 密钥和 tenant ID。
- 添加需要访问的路径和权限。
配置 Edge API 网关
- Edge 可以作为 API 网关,接收来自外部的请求并路由到后端服务。
- 通过配置路由规则和访问控制,可以实现 API 的安全访问和限流。
配置 Edge 监控和日志
- Edge 提供了详细的日志记录和监控功能,可以帮助你跟踪 Edge 的运行状态。
- 通过 Azure Portal:
- 在 Edge 的 设置 中选择 监控。
- 配置日志级别和监控端点。
- 通过 Azure CLI:
az edge deployment update --deployment-edge-deployment --parameters edgeLogLevel="Error" --parameters edgeMetricsEndpoint="https://yourmetricsendpoint.com"
使用 Edge CLI
- Edge 提供了 CLI 工具,方便你在本地环境中测试和配置 Edge 代理。
- 安装 Edge CLI:
az-edge-cli install
- 使用 CLI 配置和管理 Edge:
az-edge deployment create --deployment-edge-deployment --parameters edgeIngressIPInternal="10...1" --parameters edgeIngressPort="808"
Edge 常见问题
- 网络连接问题:确保 Edge 服务和后端应用之间有网络连接,并检查防火墙设置。
- 路由问题:检查路由规则是否正确配置,确保请求能够正确路由到后端服务。
- 证书问题:检查 TLS 端口是否正确配置,确保证书文件路径正确。
- 负载均衡问题:确保负载均衡规则正确配置,且后端池健康。




