本文介绍了两个吊舱强制部署到不同的ICP员工的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个集群Kubernetes和IBM Cloud Private,其中有两个工作人员.我有一个部署,它创建了两个Pod.如何强制部署将其吊舱安装在两个不同的工作器上?在这种情况下,如果我失去了一名icp工作人员,我总是会有其他有需要的工作人员.

There is a cluster Kubernetes and IBM Cloud Private with two workers.I have one deployment which creates two pods. How can I force deployment to install its pods on two different workers? In this case if I lost one icp worker I always have other with need pod.

推荐答案

如果不希望Pod不在同一节点上进行调度,则要使用的正确概念是Pod间反亲和力. https ://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature

If you want pods to not schedule on the same node, the correct concept that you will want to use is inter-pod anti-affinity. https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature

观察:

spec:
  replicas: 2
  selector:
    app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - my-app
            topologyKey: kubernetes.io/hostname

这篇关于两个吊舱强制部署到不同的ICP员工的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 20:26