Jen*_*y M 3 azure amazon-web-services kubernetes
我有两个副本的 pod,k8s 会同时重新安排两个副本是否有意义 ?如果是,有没有办法避免它?
我猜(根据@Henry 的回复)我需要使用https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity或
拓扑 https://kubernetes.io/blog/2020/05/introducing-podtopologyspread/
但不确定如何配置以下内容:
1
具有2
副本的应用程序,例如
Replica A
继续运行nodeFoo
和
Replica B
跑进 NodeBar
可以使用将副本配置为在不同节点上运行podAntiAffinity
。例如在部署规范中:
spec:
template:
metadata:
labels:
name: my-app-label
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
name: my-app-label
topologyKey: kubernetes.io/hostname
Run Code Online (Sandbox Code Playgroud)
这基本上意味着,所有与标签匹配的 podname=my-app-label
都应该在节点标签kubernetes.io/hostname
不同的主机上运行。
归档时间: |
|
查看次数: |
395 次 |
最近记录: |