【问题标题】:Application run on Azure AKS Kubernates can not be accessed from App Service无法从应用服务访问在 Azure AKS Kubernetes 上运行的应用程序
【发布时间】:2020-06-01 05:36:56
【问题描述】:

我在 Azure AKS 服务上配置了两个不同的应用程序(SEQ 和 MockServer)。它们都可以从 Internet 正常工作,但无法从 Azure Web 服务访问它们。它也无法从 Azure CLI 访问。 在我的下面

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mockserver-deployment
  labels:
    app: mockserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mockserver
  template:
    metadata:
      labels:
        app: mockserver
    spec:
      containers:
      - name: mockserver
        image: jamesdbloom/mockserver
        env:
        - name: LOG_LEVEL
          value: "INFO"        
        ports:
        - containerPort: 1080
      imagePullSecrets:
      - name: my-secret
---
kind: Service
apiVersion: v1
metadata:
  name: mockserver-service
spec:
  selector:
    app: mockserver
  loadBalancerIP: 51.136.53.26
  type: LoadBalancer
  loadBalancerSourceRanges:
  # from Poland
  - 62.87.152.154/32 
  - 83.30.150.205/32
  - 80.193.73.114/32
  - 195.191.163.0/24
  # from AppCenter test
  - 195.249.159.0/24
  - 195.0.0.0/8
  # from Marcin K home
  - 95.160.157.0/24
  - 93.105.0.0/16
  ports:
  - port: 1080
    targetPort: 1080
    name: mockserver

【问题讨论】:

  • 那么,问题出在哪里?您不允许您的 IP 地址范围 - 它不起作用。惊喜?
  • 问题是即使我将它打开到整个互联网,也无法从 azure Web 服务或 CLI 访问。如何允许网络服务访问它?
  • 这显然不是真的

标签: azure kubernetes azure-virtual-network azure-aks azure-load-balancer


【解决方案1】:

最好的方法是为您的 AppService (https://docs.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet) 与内部 LoadBalancer 类型的服务 (https://docs.microsoft.com/en-us/azure/aks/internal-lb) 结合使用 VNET 集成。这样,应用服务和 AKS 之间的通信将仅通过内部 VNET 进行。请注意,您可以拥有一个外部 LB 服务,就像您已经拥有的一样;您可以让多个服务为同一组 pod 提供流量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-18
    • 1970-01-01
    • 2019-06-19
    • 2019-08-01
    • 1970-01-01
    • 2021-08-24
    • 2019-06-02
    相关资源
    最近更新 更多