Azure load balancer map to active pod

I have an azure load balancer service that sends requests to the active pod in a pair of pods:

  • pod0 is labeled active as part of the startup process
  • pod1 is labeled not active, so pod0 is active and pod1 is backup.

When pod0 goes down the azure lb keeps sending requests to pod0 even though the 2 pods know that pod1 is now active.

I’m not sure how the azure lb is supposed to get updated to point to pod1 as now being the active pod, as both pods can see who is active and who is backup. Suggestions, ideas please?

K8s configuration changes not helping in this case such as changing app name and selectors to match

Azure load balancer map to active pod

The Azure Load Balancer requires knowledge of your pods’ status to efficiently direct traffic to the active ones. Consider these approaches to address this issue:

Health Probes: Employ health probes in your Azure Load Balancer to monitor the status of backend instances. Configure a probe on your pods to check a specific endpoint that reflects the pod’s operational status. Only if the pod is active should this endpoint show a healthy response (e.g., HTTP 200).

If pod0 fails, its health probe will fail, causing the load balancer to route traffic to pod1, assuming pod1’s probe is healthy.

Custom Solution with External Watcher: Create an external service or a watcher pod to monitor the status of pod0 and pod1. This watcher should be able to adjust the load balancer’s configuration or DNS settings in real-time, ensuring traffic is redirected to the operational pod.

  • This goal can be accomplished through Azure API Management or by developing a custom API that dynamically adjusts DNS or routing configurations in response to pod states.

Azure Traffic Manager: Should the standard Load Balancer configurations prove inadequate; you might explore Azure Traffic Manager. It is capable of managing more intricate routing strategies and can be set up to manage failover more smoothly in accordance with your application’s logic.

Kubernetes Services: Double-check your Kubernetes service and deployment configurations to ensure they are set to handle failovers correctly. Typically, a Kubernetes service should automatically redirect traffic to healthy pods when configured with the right selectors and readiness/liveness probes.

simplified Kubernetes configuration

apiVersion: v1
kind: Service
metadata:
  name: your-service
spec:
  selector:
    app: your-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: your-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: your-app
  template:
    metadata:
      labels:
        app: your-app
    spec:
      containers:
      - name: your-container
        image: your-image
        ports:
        - containerPort: 9376
        readinessProbe:
          httpGet:
            path: /health
            port: 9376
          initialDelaySeconds: 3
          periodSeconds: 3
          

This example presupposes the existence of a /health endpoint in your application that indicates the pod’s active status. Modify the settings to align with your application’s actual logic and endpoints.

Reference:

https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-custom-probe-overview#configure-probe

https://learn.microsoft.com/en-us/azure/traffic-manager/traffic-manager-routing-methods

https://learn.microsoft.com/en-us/azure/application-gateway/tutorial-url-route-cli

https://learn.microsoft.com/en-us/azure/application-gateway/overview

Recognized by Microsoft Azure Collective

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật