zoukankan      html  css  js  c++  java
  • Kubernetes kubefed使用Cluster Selector

    Using Cluster Selector

    In addition to specifying an explicit list of clusters that a resource should be propagated to via the spec.placement.clusters field of a federated resource, it is possible to use the spec.placement.clusterSelector field to provide a label selector that determines a list of clusters at runtime.

    If the goal is to select a subset of member clusters, make sure that the KubeFedCluster binaries from pre-reqs [now covered by Helm installation] resources that are intended to be selected have the appropriate labels applied.

    The following command is an example to label a KubeFedCluster:

    kubectl label kubefedclusters -n kube-federation-system cluster1 foo=bar

    Please refer to Kubernetes label command for more information on how kubectl label works.

    The following sections detail how spec.placement.clusters and spec.placement.clusterSelector are used in determining the clusters that a federated resource should be propagated to.

    Neither spec.placement.clusters nor spec.placement.clusterSelector is provided

    spec:
      placement: {}

    In this case, you can either set spec: {} as above or remove spec field from your placement policy. The resource will not be propagated to member clusters.

    在这种情况下,可以如上所述设置spec:{},也可以从放置策略中删除spec字段。资源将不会传播到成员群集。

    Both spec.placement.clusters and spec.placement.clusterSelector are provided

    spec:
      placement:
        clusters:
          - name: cluster2
          - name: cluster1
        clusterSelector:
          matchLabels:
            foo: bar

    For this case, spec.placement.clusterSelector will be ignored as spec.placement.clusters is provided. This ensures that the results of runtime scheduling have priority over manual definition of a cluster selector.

    spec.placement.clusterSelector will also be ignored if spec.placement.clusters is provided but empty. In the following example, no clusters will be selected:

    spec:
      placement:
        clusters: []
        clusterSelector:
          matchLabels:
            foo: bar

    只要提供了spec.placement.clusters字段(即使其值为空),spec.placement.clusterSelector配置也会被忽略。

    spec.placement.clusters is not provided, spec.placement.clusterSelector is provided but empty

    spec:
      placement:
        clusterSelector: {}

    In this case, the resource will be propagated to all member clusters.

    在这种情况下,资源将传播到所有成员集群。

    spec.placement.clusters is not provided, spec.placement.clusterSelector is provided and not empty

    spec:
      placement:
        clusterSelector:
          matchLabels:
            foo: bar

    In this case, the resource will only be propagated to member clusters that are labeled with foo: bar.

    在这种情况下,资源将只传播到标有foo:bar的成员集群。

    摘自:https://github.com/kubernetes-sigs/kubefed/blob/master/docs/userguide.md#using-cluster-selector

  • 相关阅读:
    第二篇:服务消费者Feign
    第一篇:服务的注册与发现Eureka(Finchley版本)
    记一次包扫描的犯错
    0.简单工厂-simplefactory(非23之一)
    设计模式基础
    设计模式--六大设计原则
    Java中的包
    Java内部类
    Java多线程
    Java同步
  • 原文地址:https://www.cnblogs.com/zhangmingcheng/p/15458377.html
Copyright © 2011-2022 走看看