K8S集群级拓扑分布

huangapple go评论54阅读模式
英文:

K8S Cluster level topology spread

问题

尝试在集群级别设置默认的 podTopologySpead。使用了来自 k8s 文档的建议配置:https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#cluster-level-default-constraints :

apiVersion: kubescheduler.config.k8s.io/v1beta3
kind: KubeSchedulerConfiguration

profiles:
  - schedulerName: default-scheduler
    pluginConfig:
      - name: PodTopologySpread
        args:
          defaultConstraints:
            - maxSkew: 1
              topologyKey: topology.kubernetes.io/zone
              whenUnsatisfiable: ScheduleAnyway
          defaultingType: List

应用时出现以下错误:

➜ kubectl apply -f ./topology-test
error: unable to recognize "./topology-test": no matches for kind "KubeSchedulerConfiguration" in version "kubescheduler.config.k8s.io/v1beta3"

也尝试将 API 版本更改为 v1beta1v1beta2v1alpha1v1

另外一个问题:这个配置不需要提及命名空间吗?

英文:

EKS 1.23

Trying to set default podTopologySpead on cluster level. Using the suggested config from k8s documentation: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/#cluster-level-default-constraints :

apiVersion: kubescheduler.config.k8s.io/v1beta3
kind: KubeSchedulerConfiguration

profiles:
  - schedulerName: default-scheduler
    pluginConfig:
      - name: PodTopologySpread
        args:
          defaultConstraints:
            - maxSkew: 1
              topologyKey: topology.kubernetes.io/zone
              whenUnsatisfiable: ScheduleAnyway
          defaultingType: List

when applying I get the following error:

➜ kubectl apply -f ./topology-test
error: unable to recognize "./topology-test": no matches for kind "KubeSchedulerConfiguration" in version "kubescheduler.config.k8s.io/v1beta3"

Also tried to change api version to v1beta1, v1beta2,v1alpha1,v1.

another question regarding it: isn't this configuration requires namespace mention?

答案1

得分: 1

你可以通过编写配置文件并将其路径作为命令行参数传递来自定义 kube-scheduler 的行为。

你需要将配置作为参数传递给 kube-scheduler,例如 kube-scheduler --config <filename>

此外,你可以运行 kubectl api-versions 命令来打印服务器上支持的 API 版本。

请参考文档获取详细信息。

更新

看起来在 Amazon EKS 中无法更新 default-scheduler,你需要在 EKS 中创建一个 custom scheduler,然后在新的 scheduler 中传入你的 KubeSchedulerConfiguration,你可以在这里找到一个示例 YAML。

此外,请查看这个关于 kube-scheduler 在 EKS 中相关 Stack Overflow 问题

英文:

> You can customize the behavior of the kube-scheduler by writing a
> configuration file and passing its path as a command line argument.

You need to pass configuration as an argument to the kube-scheduler like kube-scheduler --config &lt;filename&gt;.

Additionally you can run kubectl api-versions to print the supported API versions on the server.

Please refer the docs for details

UPDATE

As it seems, you cannot update the default-scheduler in EKS, you will need to create a custom scheduler in EKS and then pass in your KubeSchedulerConfiguration within the new scheduler, a sample YAML for it can be found here.

Also check this related SO question about kube-scheduler in EKS

huangapple
  • 本文由 发表于 2023年2月23日 21:03:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75545205.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定