简体   繁体   English

无法通过 AKS 上的 Azure 流量管理器和 Nginx 入口访问服务

[英]Unable to reach services via Azure Traffic Manager and Nginx Ingress on AKS

I have two AKS clusters as primary and secondary in two different regions.我在两个不同的区域有两个 AKS 集群作为主要和次要集群。 I want to use Azure traffic manager for the the Priority based endpoint monitoring and fail-over mechanism on the primary and secondary clusters.我想将 Azure 流量管理器用于主集群和辅助集群上的基于优先级的端点监控和故障转移机制。 I got two services: A and B that routes at the relative path /service-a and /service-b respectively.我有两个服务:A 和 B 分别在相对路径/service-a/service-b上路由。 I have nginx ingress controller on each cluster with PIP mapped to the custom host aks-primary.xyz.com and aks-secondary.xyz.com respectively. I have nginx ingress controller on each cluster with PIP mapped to the custom host aks-primary.xyz.com and aks-secondary.xyz.com respectively.

The services are reachable on the below paths:这些服务可通过以下路径访问:

On Primary Custer:在主卡斯特上:

https://aks-primary.xyz.com/service-a https://aks-primary.xyz.com/service-a

https://aks-primary.xyz.com/service-b https://aks-primary.xyz.com/service-b

On secondary cluster:在辅助集群上:

https://aks-secondary.xyz.com/service-a https://aks-secondary.xyz.com/service-a

https://aks-secondary.xyz.com/service-b https://aks-secondary.xyz.com/service-b

I added the primary and secondary host aks-primary.xyz.com and aks-secondary.xyz.com as the endpoint in the Azure Traffic Manager for priority based routing.我将主要和辅助主机aks-primary.xyz.comaks-secondary.xyz.com添加为 Azure 流量管理器中的端点,用于基于优先级的路由。 I added the probe path /healthz and port 443. My endpoints are online.我添加了探测路径/healthz和端口 443。我的端点在线。

I added the custom domain for the ATM FQDN my-atm.trafficmanager.net to aks.xyz.com I am unable to reach to my services on below paths我将 ATM FQDN my-atm.trafficmanager.net 的自定义域添加到 aks.xyz.com 我无法通过以下路径访问我的服务

https://aks.xyz.com/service-a https://aks.xyz.com/service-a

https://aks.xyz.com/service-b https://aks.xyz.com/service-b

Please suggest.请建议。

I got this resolved.我解决了这个问题。

I added the ingress with two hosts on each cluster.我在每个集群上添加了两个主机的入口。

hosts: aks-primary.xyz.com and aks.xyz.com on cluster aks primary.主机: aks-primary.xyz.comaks.xyz.com在集群 aks 主节点上。

hosts: aks-secondary.xyz.com and aks.xyz.com on cluster aks secondary.主机:集群 aks 辅助服务器上的 aks-secondary.xyz.comaks.xyz.com

A sample ingress on cluster aks primary:集群上的示例入口 ks 主要:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-with-atm
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: aks-primary.xyz.com
    http:
      paths:
      - backend:
          serviceName: service-a
          servicePort: 80
        path: /service-a
      - backend:
          serviceName: service-b
          servicePort: 80
        path: /service-b
  - host: aks.xyz.com
    http:
      paths:
      - backend:
          serviceName: service-a
          servicePort: 80
        path: /service-a
      - backend:
          serviceName: service-b
          servicePort: 80
        path: /service-b
  tls:
  - hosts:
    - aks-primary.xyz.com
    secretName: tls-secret-wildcard-for-xyz-com
  - hosts:
    - aks.xyz.com
    secretName: tls-secret-wildcard-for-xyz-com`

Cheers!干杯!

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

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