共计 587 个字符,预计需要花费 2 分钟才能阅读完成。
当一个 pod 在同一台服务器上,同时这个 pod 如果消耗了大量资源,就需要进行反亲和力配置,让这个 pod 不在同一节点上。
参考如下
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- store
topologyKey: "kubernetes.io/hostname"
containers:
- name: redis-server
image: redis:3.2-alpine
#最新配置
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- ${DOCKER_NAME}
topologyKey: "kubernetes.io/hostname"
参考链接 https://kubernetes.io/zh/docs/concepts/scheduling-eviction/assign-pod-node/
正文完