<p>I'm trying to figure out how to configure the kubernetes scheduler using a custom config but I'm having a bit of trouble understanding exactly how the scheduler is accessible.</p>
<p>The scheduler runs as a pod under the <code>kube-system</code> namespace called <code>kube-scheduler-it-k8s-master</code>. <a href="https://kubernetes.io/docs/reference/scheduling/config/" rel="nofollow noreferrer">The documentation</a>  says that you can configure the scheduler by creating a config file and calling <code>kube-scheduler --config &lt;filename&gt;</code>. However I am not able to access the scheduler container directly as running <code>kubectl exec -it kube-scheduler-it-k8s-master -- /bin/bash</code> returns:</p>
<pre><code>OCI runtime exec failed: exec failed: container_linux.go:370: starting container process caused: exec: &quot;/bin/bash&quot;: stat /bin/bash: no such file or directory: unknown
command terminated with exit code 126
</code></pre>
<p>I tried modifying <code>/etc/kubernetes/manifests/kube-scheduler</code> to mount my custom config file within the pod and explicitly call <code>kube-scheduler</code> with the <code>--config</code> option set, but it seems that my changes get reverted and the scheduler runs using the default settings.</p>
<p>I feel like I'm misunderstanding something fundamentally about the kubernetes scheduler. Am I supposed to pass in the custom scheduler config from within the scheduler pod itself? Or is this supposed to be done remotely somehow?</p>
<p>Thanks!</p>

Smaugy
<p>Since your <a href="https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem">X problem</a> is &quot;how to modify scheduler configuration&quot;, you can try the following for it.</p>
<hr />
<h3>Using kubeadm</h3>
<p>If you are using <code>kubeadm</code> to bootstrap the cluster, you can use <code>--config</code> flag while running <code>kubeadm init</code> to pass a custom configuration object of type <code>ClusterConfiguration</code> to pass extra arguments to control plane components.</p>
<p>Example config for scheduler:</p>
<pre><code>$ cat sched.conf
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: v1.16.0
scheduler:
  extraArgs:
    address: 0.0.0.0
    config: /home/johndoe/schedconfig.yaml
    kubeconfig: /home/johndoe/kubeconfig.yaml
</code></pre>
<pre><code>$ kubeadm init --config sched.conf
</code></pre>
<p>You could also try <code>kubeadm upgrade apply --config sched.conf &lt;k8s version&gt;</code> to apply updated config on a live cluster.</p>
<p>Reference: <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/" rel="nofollow noreferrer">https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/</a></p>
<hr />
<h3>Updating <a href="https://stackoverflow.com/questions/59612514/whats-the-difference-between-pods-and-static-pods-in-kubernetes-and-when-to">static pod</a> manifest</h3>
<p>You could also edit <code>/etc/kubernetes/manifests/kube-scheduler.yaml</code>, modify the flags to pass the config. Make sure you mount the file into the pod by updating <code>volumes</code> and <code>volumeMounts</code> section.</p>
<pre><code>spec:
  containers:
  - command:
    - kube-scheduler
    - --authentication-kubeconfig=/etc/kubernetes/scheduler.conf
    - --authorization-kubeconfig=/etc/kubernetes/scheduler.conf
    - --bind-address=127.0.0.1
    - --kubeconfig=/etc/kubernetes/scheduler.conf
    - --leader-elect=true
    - --config=/etc/kubernetes/mycustomconfig.conf
    volumeMounts:
    - mountPath: /etc/kubernetes/scheduler.conf
      name: kubeconfig
      readOnly: true
    - mountPath: /etc/kubernetes/mycustomconfig.conf
      name: customconfig
      readOnly: true
  volumes:
  - hostPath:
      path: /etc/kubernetes/scheduler.conf
      type: FileOrCreate
    name: kubeconfig
  - hostPath:
      path: /etc/kubernetes/mycustomconfig.conf
      type: FileOrCreate
    name: customconfig
</code></pre>
