《Windows Azure Platform 系列文章目录》
我们在使用Azure AKS的时候,会通过Azure Application Gateway进行服务暴露,主要有三种实现方式:
(1)通过AGIC (Application Gateway Ingress Controller)配置
(2)AKS服务,通过Node Port暴露。然后Application Gateway后端池指向到Azure AKS Node Port内网IP地址
(3)AKS服务,通过Internal Load Balancer暴露。然后Application Gateway后端池,指向到Azure AKS Internal Load Balancer负载均衡器内网IP
第一种配置方式,可以参考:https://learn.microsoft.com/en-us/azure/application-gateway/ingress-controller-install-existing
第二种配置方式,具体部署步骤如下:
1.手动创建Azure application Gateway,步骤略。
2.创建Azure AKS SVC,服务暴露通过Nodeport暴露,如下:
apiVersion: apps/v1 kind: Deployment metadata: name: scnginx-deployment labels: app: scnginx spec: replicas: 9 selector: matchLabels: app: scnginx template: metadata: labels: app: scnginx spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: scnginx-service spec: type: NodePort selector: app: scnginx ports: - name: nginx-svc-nodeport protocol: TCP port: 80 targetPort: 80 nodePort: 30009
3.通过执行kubectl get node -o wide,查看AKS Node的内网IP地址。具体截图略
4.Application Gateway的后端IP地址,指向到AKS Node 的内网IP
第三种配置方式,具体部署步骤如下:
1.创建Azure AKS SVC,服务暴露通过Azure内网负载均衡器实现。文件名指定为:2.azure_svc_internal_lb.yaml
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 9 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: nginx-service-lb annotations: #指定负载均衡器的内网IP,请按照实际场景修改 service.beta.kubernetes.io/azure-load-balancer-ipv4: 10.0.4.4 #指定负载均衡器的类型,为内网 service.beta.kubernetes.io/azure-load-balancer-internal: "true" #指定负载均衡器所在的子网 service.beta.kubernetes.io/azure-load-balancer-internal-subnet: "internal-lb-subnet" spec: type: LoadBalancer selector: app: nginx ports: - name: nginx-svc-intenral-lb protocol: TCP port: 80 targetPort: 80 nodePort: 30009
2.执行kubectl apply -f 2.azure_svc_internal_lb.yaml,创建服务
3.通过kubectl get svc,获得服务信息,改服务通过内网负载均衡器IP:10.0.4.4暴露
4.Application Gateway后端池的IP,指向到Azure内网负载均衡器IP:10.0.4.4
标签:12,nginx,AKS,Application,均衡器,Azure,内网,Gateway From: https://www.cnblogs.com/threestone/p/18413613