What is the relationship between scheduling policies and scheduling Configuration in k8s

116 Views Asked by At

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.

1

There are 1 best solutions below

2
Bazhikov On

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.