基于集群联邦进行多集群应用分发与管理 步骤三:创建调度策略 调度策略(PropagationPolicy)模板参考如下,可基于实际需要调整其中的污点容忍及负载拆分策略等: shell propagationpolicy.yaml apiVersion: policy.karmada.io/v1alpha1 kind: PropagationPolicy metadata: name: examplepolicy The default namespace is default. spec: propagateDeps: true resourceSelectors: apiVersion: apps/v1 kind: Deployment name: nginx If no namespace is specified, the namespace is inherited from the parent object scope. placement: clusterAffinity: 指定目标集群 clusterNames: ccecceonedemo1 ccecceonedemo2 clusterTolerations: 容忍成员集群污点,影响调度逻辑 key: cluster.karmada.io/notready operator: Exists effect: NoExecute tolerationSeconds: 300 key: cluster.karmada.io/unreachable operator: Exists effect: NoExecute tolerationSeconds: 300 replicaScheduling: 指定工作负载副本在成员集群间的分发策略 replicaSchedulingType: Divided replicaDivisionPreference: Weighted weightPreference: staticWeightList: targetCluster: clusterNames: ccecceonedemo1 weight: 1 targetCluster: clusterNames: ccecceonedemo2 weight: 2 通过如下命令,将调度策略apply到联邦控制面中 shell $ kubectl kubeconfig/home/ctyun/.kube/cceonefed.yaml apply f propagationpolicy.yaml propagationpolicy.policy.karmada.io/examplepolicy created ctyun@0000000gFxXsKxFWUv:~/tmp$ kubectl kubeconfig/home/ctyun/.kube/cceonefed.yaml get propagationpolicy examplepolicy NAME CONFLICTRESOLUTION PRIORITY AGE examplepolicy Abort 0 13s 此时,通过如下命令,查看工作负载在多集群之间的调度情况: shell