Inter |
您所在的位置:网站首页 › pod一直处于pending › Inter |
Inter-pod topological affinity and anti-affinity(pod之间拓扑上的关联与反关联) 翻译 podAffinityrequiredDuringSchedulingIgnoredDuringExecutionapiVersion: v1kind: Podmetadata: name: test1spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: "mysvc" operator: In values: - S1 topologyKey: kubernetes.io/hostname containers: - name: dao-2048 image: daocloud.io/daocloud/dao-2048 imagePullPolicy: IfNotPresent 通过该文件创建得到的pod,一直处于pending状态,错误原因如下图![]() ![]() 通过配置文件产生pod,观察可得pod的状态为running,由此可知preferredDuringScheduling下的affinity为非必须条件。 podAntiAffinityrequiredDuringSchedulingIgnoredDuringExecutionapiVersion: v1kind: Podmetadata: name: test4 labels: security: S1spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: security operator: In values: - S1 topologyKey: kubernetes.io/hostname containers: - name: dao-2048 image: daocloud.io/daocloud/dao-2048 imagePullPolicy: IfNotPresent使用该文件创建3个pod,可以发现3个pod运行在不同的node上。 使用该配置模板创建三个pod,可以发现pod依旧分配到了不同的节点上。当创建第四个pod时,第四个pod能够被顺利创建,说明preferredDuringScheduling在podAntiAnffinity下也是不严格匹配规则。 以及 apiVersion: v1kind: Podmetadata: name: test2 labels: security: S1spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: security operator: In values: - S1 topologyKey: kubernetes.io/hostname containers: - name: dao-2048 image: daocloud.io/daocloud/dao-2048 imagePullPolicy: IfNotPresent先使用第二个配置文件创建两个pod,再用第一个文件创建一个pod,可以观察到,三个pod在三个不同的node上。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |