veza/k8s/load-balancing/cloud-load-balancers/azure-lb.yaml

72 lines
2.2 KiB
YAML

# Azure Load Balancer Configuration
# This configuration uses Azure-native load balancing
apiVersion: v1
kind: Service
metadata:
name: veza-backend-api-lb
namespace: veza-production
annotations:
# Use Azure Load Balancer
service.beta.kubernetes.io/azure-load-balancer-internal: "false"
service.beta.kubernetes.io/azure-load-balancer-internal-subnet: "subnet-name"
# Health probe
service.beta.kubernetes.io/azure-load-balancer-health-probe-request-path: "/health"
service.beta.kubernetes.io/azure-load-balancer-health-probe-interval: "10"
service.beta.kubernetes.io/azure-load-balancer-health-probe-num-of-probe: "3"
service.beta.kubernetes.io/azure-load-balancer-health-probe-timeout: "5"
# Load balancing algorithm
service.beta.kubernetes.io/azure-load-balancer-mode: "Standard" # or "Basic"
# Session affinity
service.beta.kubernetes.io/azure-load-balancer-tcp-idle-timeout: "240"
spec:
type: LoadBalancer
ports:
- name: http
port: 80
targetPort: 8080
protocol: TCP
- name: https
port: 443
targetPort: 8080
protocol: TCP
selector:
app: veza-backend-api
---
# Ingress for Azure (using Nginx Ingress with Azure Application Gateway)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: veza-ingress-azure
namespace: veza-production
annotations:
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/ssl-redirect: "true"
appgw.ingress.kubernetes.io/backend-protocol: "http"
appgw.ingress.kubernetes.io/health-probe-path: "/health"
appgw.ingress.kubernetes.io/health-probe-interval: "10"
appgw.ingress.kubernetes.io/health-probe-timeout: "5"
appgw.ingress.kubernetes.io/health-probe-unhealthy-threshold: "3"
appgw.ingress.kubernetes.io/cookie-based-affinity: "true"
appgw.ingress.kubernetes.io/request-timeout: "60"
spec:
tls:
- hosts:
- api.veza.com
- app.veza.com
secretName: veza-tls
rules:
- host: api.veza.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: veza-backend-api
port:
number: 8080