2

The k8s scheduling implementation comes in two forms: Scheduling Policies and Scheduling Profiles.

What is the relationship between the two? They seem to overlap but have some differences. For example, there is a NodeUnschedulable in the profiles but not in the policy. CheckNodePIDPressure is in the policy, but not in the profiles

In addition, there is a default startup option in the scheduling configuration, but it is not specified in the scheduling policy. How can I know about the default startup policy?

I really appreciate any help with this.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
moluzhui
  • 1,003
  • 14
  • 34

1 Answers1

1

The difference is simple: Kubernetes does't support 'Scheduling policies' from v1.19 or later. Kubernetes v1.19 supports configuring multiple scheduling policies with a single scheduler. We are using this to define a bin-packing scheduling policy in all v1.19 clusters by default. 'Scheduling profiles' can be used to define a bin-packing scheduling policy in all v1.19 clusters by default.

To use that scheduling policy, all that is required is to specify the scheduler name bin-packing-scheduler in the Pod spec. For example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 5
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      schedulerName: bin-packing-scheduler
      containers:
      - name: nginx
        image: nginx:1.17.8
        resources:
          requests:
            cpu: 200m

The pods of this deployment will be scheduled onto the nodes which already have the highest resource utilisation, to optimise for autoscaling or ensuring efficient pod placement when mixing large and small pods in the same cluster.

If a scheduler name is not specified then the default spreading algorithm will be used to distribute pods across all nodes.

Bazhikov
  • 765
  • 3
  • 11
  • Does that mean I can't use in the v1.18 `KubeSchedulerConfiguration` to configure a second scheduler, it replaces the `LeastRequest` algorithm with `MostRequest`. If this is not possible, using Policy must know which scheduler is used by `default`, because I want to `make minimal changes` – moluzhui Nov 27 '21 at 13:00
  • you can try to use `KubeSchedulerConfiguration` API: https://kubernetes.io/docs/reference/config-api/kube-scheduler-config.v1beta1/. I don't know if this works for you. Don't you consider to switch to kubernetes v.1.19+ ? – Bazhikov Dec 07 '21 at 09:59