feat: add pod anti-affinity rules for taw app

- Introduce podAntiAffinity settings to avoid scheduling
  multiple Pods with the same app: taw label on the same
  node.
- This is a soft requirement, meaning that if there are
  not enough nodes, Pods may still be scheduled on the
  same node.

This change enhances the deployment strategy by improving
availability and fault tolerance of the taw application.
This commit is contained in:
songtianlun 2025-04-23 20:56:32 +08:00
parent 4f06b0151e
commit 9791f0118f

View File

@ -36,6 +36,19 @@ spec:
- vkvm-us1
- vkvm-us2
- zgocloud-us1
podAntiAffinity:
# 尽量避免将拥有相同 app: taw 标签的 Pod 调度到同一节点上
# 这是一个"软性"要求,如果没有足够的节点,多个 Pod 仍可能调度到同一节点
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- taw
topologyKey: kubernetes.io/hostname
containers:
- name: app
image: songtianlun/today_ai_weather:main