Azure Lei Zhang的博客

weibo: LeiZhang的微博/QQ: 185165016/QQ群:319036205/邮箱:leizhang1984@outlook.com/TeL:139-161-22926

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  489 随笔 :: 0 文章 :: 417 评论 :: 70万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

  《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

 

 

  

posted on   Lei Zhang的博客  阅读(56)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示