简体   繁体   English

如何将STS应用程序和目标Pod调度到OpenEBS中的同一节点?

[英]How to schedule a STS application and target pods to the same node in OpenEBS?

We have a setup (6 nodes with ephemeral SSD connected in GKE k8s 1.10) and application StatefulSet with 6 replicas. 我们有一个设置(在GKE k8s 1.10中连接了6个具有临时SSD的节点)和带有6个副本的应用程序StatefulSet。 The plan is to map 1 to 1 application pod to a node and use target affinity to keep jiva target pods on the same node as the application pod. 该计划是将一对一的应用程序容器映射到一个节点,并使用目标关联性将jiva目标容器与应用程序容器保持在同一节点上。 Data replication/redundancy solved at an application layer so we need the only 1 replica setup for storage class. 数据复制/冗余在应用程序层解决,因此我们只需要为存储类设置一个副本。

Target affinity policy can be used to co-locate volume target pod on the same node as workload. 目标相似性策略可用于将卷目标Pod与工作负载共同定位在同一节点上。

This feature makes use of the Kubernetes Pod Affinity feature that is dependent on the Pod labels. 该功能利用了依赖于Pod标签的Kubernetes Pod Affinity功能。 User will need to add the following label to both Application and PVC. 用户将需要在Application和PVC上添加以下标签。

labels:
  openebs.io/target-affinity: <application-unique-label>

You can specify the Target Affinity in both application and OpenEBS PVC using the following way, For Application Pod, it will be similar to the following 您可以使用以下方式在应用程序和OpenEBS PVC中指定目标关联性,对于“应用程序包”,它类似于以下内容

apiVersion: v1
kind: Pod
metadata:
  name: fio-jiva
  labels:
    name: fio-jiva
    openebs.io/target-affinity: fio-jiva

For OpenEBS PVC, it will be similar to the following. 对于OpenEBS PVC,将类似于以下内容。

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: fio-jiva-claim
  labels:
    openebs.io/target-affinity: fio-jiva

Note: This feature works only for cases where there is a 1-1 mapping between a application and PVC. 注意:此功能仅适用于应用程序与PVC之间存在1-1映射的情况。 It's not recommended for STS where PVC is specified as a template. 不建议将PVC指定为模板的STS使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM