Azure Mooncake 搭建 AKS-Engine (二) - Azure Application Gateway 与 AKS-Engine 集成

Step1 : 创建K8S内网负载均衡器(静态IP)

在aks-engine的资源组(yute-demo)中创建静态IP

az network public-ip create \
    --resource-group yute-demo \
    --name myAKSPublicIP \
    --allocation-method static

Console:

10.240.0.96

Step2 : 用静态IP创建K8S内网负载均衡器

 修改对外提供服务的 Service 文件

加入annotations:annotations: service.beta.kubernetes.io/azure-load-balancer-internal: "true" 和第一步创建的静态IP

apiVersion: v1
kind: Service
metadata:
  name: internal-app
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
  type: LoadBalancer
  loadBalancerIP: 10.240.0.96
  ports:
  - port: 80

Step3 : 验证内部负载均衡器创建成功

$ kubectl get service internal-app

NAME           TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
internal-app   LoadBalancer   10.0.184.168   10.240.0.96   80:30225/TCP   4m

Step4 :在Vnet 中创建Application gateway 需要的子网

Step4.1 : 在resource group 中filter net ,点击filter出来的Vnet进入

Step4.2 :添加子网

 

Step5:新建Application Gateway

从Portal 新建Application Gateway ,填入k8s-vnet 和新建的appgateway subnet,设置Dns

Step6 :添加K8S的内网IP到Application Gateway 的后端池

application gateway 创建完成后点击左侧Backend pool,点击 appGatewayBackendPool 进入编辑

选择IP address 模式,添加K8S的内网IP 并保存

Step7 :Application Gateway 创建完成 ,通过Frontend public IP 进行访问

猜你喜欢

转载自www.cnblogs.com/mumusansmile/p/10599210.html