App Gateway(AGIC)没有指向服务,而是指向AKS中的Pod。

huangapple go评论71阅读模式
英文:

App Gateway(AGIC) not pointing to service instead pointing to pods in the AKS

问题

以下是您要翻译的内容:

  1. 如果我们需要带有内部负载均衡器的服务,还是只需默认公开 ClusterIP 的服务。
  2. 目前,我的 .NET 应用程序正在公开端口 8080,而服务正在公开端口 8000。由于 AGIC 直接指向 Pods,服务和 Pods 是否应该公开相同的端口?
  3. 如果它将直接添加 Pod 的 IP,那么在自动扩展的情况下,它将如何工作,会在发生时添加/删除 Pods 的 IP?

这里是您的示例部署 YAML 文件:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sampleservice-deployment
  labels:
    app: sampleservice
spec:
  replicas: 2
  selector:
    matchLabels:
      app: sampleservice
  template:
    metadata:
      labels:
        app: sampleservice
    spec:
      containers:
        - name: sampleapi
          image: #{containerRepo}#/samplesvc:#{tag}#
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
              protocol: TCP
          resources:
            requests:
              cpu: #{hpa_samplesvc_requestedcpu}#
            limits:
              cpu: #{hpa_samplesvc_maxcpulimit}#
---
apiVersion: v1
kind: Service
metadata:
  name: samplesvc
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
  labels:
    app: samplesvc
spec:
  ports:
    - name: http-port
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: sampleservice
  type: LoadBalancer
---
apiVersion: autoscaling/v2
<not relevant>
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sampleingress
  annotations:
    kubernetes.io/ingress.class: azure/application-gateway
spec:
  rules:
  - http:
      paths:
      - path: /sample-path
        backend:
          service:
            name: samplesvc
            port:
              number: 8080
        pathType: Exact

这些是您的翻译结果,没有包括代码部分。如果您有其他问题或需要进一步帮助,请随时提出。

英文:

I am trying out AGIC, Previously, we have APIM premium with services deployed in AKS with internal loadbalancer and APIM can communicate with it directly because of VNet integration. My current setup is I am have a deployment with two pods and a service with internal load balancer(I dont think its required) and an Ingress path for the service. I was assuming that when I deploy the yaml file it will create a backendpool in App gateway with the IP of the service instead the ingress created the IP of the pods and added two IP, obviously I have two pods. I wanted to know,

  1. If we need service with internal loadbalancer or just service with default exposure of clusterip.
  2. Currently, my dotnet application is exposing port 8080, and the service was exposing 8000. since AGIC is directly pointing to pods, the service and the pods should expose the same ports?
  3. if its going to add the pod's IP directly how it will work incase of autoscale it will add/remove the pods ip as and when it happens ?

I wasn going through app gateway documentation, I couldnt fetch much information from there.

sample deployment yaml file

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sampleservice-deployment
  labels:
    app: sampleservice
spec:
  replicas: 2
  selector:
    matchLabels:
      app: sampleservice
  template:
    metadata:
      labels:
        app: sampleservice
    spec:
      containers:
        - name: sampleapi
          image: #{containerRepo}#/samplesvc:#{tag}#
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
              protocol: TCP
          resources:
            requests:
              cpu: #{hpa_samplesvc_requestedcpu}#
            limits:
              cpu: #{hpa_samplesvc_maxcpulimit}#
---
apiVersion: v1
kind: Service
metadata:
  name: samplesvc
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: &quot;true&quot;
  labels:
    app: samplesvc
spec:
  ports:
    - name: http-port
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: sampleservice
  type: LoadBalancer
---
apiVersion: autoscaling/v2
&lt;not relevant&gt;
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sampleingress
  annotations:
    kubernetes.io/ingress.class: azure/application-gateway
spec:
  rules:
  - http:
      paths:
      - path: /sample-path
        backend:
          service:
            name: samplesvc
            port:
              number: 8080
        pathType: Exact

here is deployment.yaml

答案1

得分: 0

  1. -> 只需具有默认的 clusterIP 暴露的服务
  2. -> 服务和 Pod 都应具有与在 Ingress YAML 文件中为各个路径配置的端口相同的端口
  3. -> 当部署扩展时,新的 Pod 启动并具有 IP 地址时,这些 IP 地址将直接添加到 AG 的后端池中。

基本上会有一个部署的 AGIC Pod,该 Pod 的主要目的是监视更改并反映回去。

更多信息:

Ingress 控制器在客户的 AKS 上运行在其自己的 Pod 中。AGIC 监视 Kubernetes 资源的子集以进行更改。AKS 集群的状态被转换为特定于 Application Gateway 的配置,并应用于 Azure 资源管理器 (ARM)。

英文:

To answer your questions directly:-

  1. -> Just have a service with default exposure of clusterIP
  2. -> Both the Service and Pods should have the same Port as it is being configured for individual paths in the ingress YAML file
  3. -> As and when your deployment scales when the new pods comes up with IPs, those IPs will be added directly to the Backend pools of AG.

Basically there will be a AGIC pod which gets deployed and the main purpose of that pod is to monitor the changes and reflect back

More information:

The Ingress Controller runs in its own pod on the customer’s AKS. AGIC monitors a subset of Kubernetes Resources for changes. The state of the AKS cluster is translated to Application Gateway specific configuration and applied to the Azure Resource Manager (ARM).

huangapple
  • 本文由 发表于 2023年6月19日 16:28:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76504905.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定