0

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?

jrz
  • 1,213
  • 4
  • 20
  • 54

1 Answers1

1

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 <filename>.

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

Sibtain
  • 1,436
  • 21
  • 39
  • From where should the command `kube-scheduler --config ` be ran? my local machine doesn't recognize `kube-scheduler` command. – jrz Feb 26 '23 at 14:11
  • this isn't a CLI command, you need to pass in this config to the `kube-scheduler` executable, if you cannot update the default scheduler, you create a [custom scheduler](https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/#define-a-kubernetes-deployment-for-the-scheduler) as well – Sibtain Feb 26 '23 at 16:15
  • Thanks, so how do I "pass in this config"? – jrz Feb 27 '23 at 10:01
  • I am using EKS1.23. What is the procedure in order to make this configuration applied to the kube-scheduler? – jrz Feb 27 '23 at 12:03
  • I don't think you can update the default scheduler in EKS (by passing the config), you need to create a [custom scheduler](https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/) and then while creation you can pass in the `kube-scheduler --config ` option. See this related [SO question](https://stackoverflow.com/questions/66442233/how-to-change-the-behaviour-of-kube-scheduler-in-eks) as well – Sibtain Feb 27 '23 at 12:39