veza/k8s/load-balancing/services-with-lb.yaml

73 lines
1.5 KiB
YAML
Raw Permalink Normal View History

# Enhanced Services with Load Balancing Configuration
# These services include session affinity, health checks, and load balancing optimizations
---
# Backend API Service with Session Affinity
apiVersion: v1
kind: Service
metadata:
name: veza-backend-api
namespace: veza-production
labels:
app: veza-backend-api
annotations:
# Optional: For cloud load balancers
# service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
# service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
spec:
type: ClusterIP
# Session affinity for stateful operations (optional)
# Uncomment if needed for sticky sessions
# sessionAffinity: ClientIP
# sessionAffinityConfig:
# clientIP:
# timeoutSeconds: 3600 # 1 hour
ports:
- name: http
port: 8080
targetPort: 8080
protocol: TCP
selector:
app: veza-backend-api
---
# Frontend Service
apiVersion: v1
kind: Service
metadata:
name: veza-frontend
namespace: veza-production
labels:
app: veza-frontend
spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
selector:
app: veza-frontend
---
# Stream Server Service
apiVersion: v1
kind: Service
metadata:
name: veza-stream-server
namespace: veza-production
labels:
app: veza-stream-server
spec:
type: ClusterIP
ports:
- name: http
port: 8080
targetPort: 8080
protocol: TCP
- name: ws
port: 8081
targetPort: 8081
protocol: TCP
selector:
app: veza-stream-server