everpeace / k8s-scheduler-extender-example

An example of kubernetes scheduler extender

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to see Priority call

chlung opened this issue · comments

Hi,

Thanks for sharing this example. I do have a question about priority. I try to observe priority api call by adding some debug logging, but I am not able to see these code has been hit. For example,

Func: func(_ v1.Pod, nodes []v1.Node) (schedulerapi.HostPriorityList, error) {
log.Print("
*************** Available Node for Priority ***********")
...

It looks like the api call has not been reached to that function. Do you have any suggestions?

Thanks.

commented

+1

I did figure out my issue. I was running minikube which is a single node. kube-scheduler won't call scheduler extender for priority assignment because it does not need to compare with score.

Thanks.

commented

I was running on a cluster with 10 nodes ,the k8s's version is 1.10 and I have found the prioritize was not used when test-pod was shceduled.
image
image

thers is no any log about prioritize:

image

but the test-pod worked well:

root@ubuntu:~/k8s-scheduler-extender-example# kubectl describe pod test-pod
Name:         test-pod
Namespace:    default
Node:         node4/192.168.10.5
Start Time:   Fri, 20 Jul 2018 20:26:18 +0800
Labels:       <none>
Annotations:  <none>
Status:       Running
IP:           10.42.136.211
Containers:
  nginx:
    Container ID:   docker://9e71d27e6ef0472f6cf79919db83295cf7f7f092477087048e68f5bf7c4dda61
    Image:          nginx
    Image ID:       docker-pullable://nginx@sha256:4a5573037f358b6cdfa2f3e8a9c33a5cf11bcd1675ca72ca76fbe5bd77d0d682
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Fri, 20 Jul 2018 20:26:24 +0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-p2lrw (ro)
Conditions:
  Type           Status
  Initialized    True 
  Ready          True 
  PodScheduled   True 
Volumes:
  default-token-p2lrw:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-p2lrw
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason                 Age   From            Message
  ----    ------                 ----  ----            -------
  Normal  Scheduled              11m   my-scheduler    Successfully assigned test-pod to node4
  Normal  SuccessfulMountVolume  11m   kubelet, node4  MountVolume.SetUp succeeded for volume "default-token-p2lrw"
  Normal  Pulling                11m   kubelet, node4  pulling image "nginx"
  Normal  Pulled                 11m   kubelet, node4  Successfully pulled image "nginx"
  Normal  Created                11m   kubelet, node4  Created container
  Normal  Started                11m   kubelet, node4  Started container
root@ubuntu:~/k8s-scheduler-extender-example# 

sorry for long absent.

I think b8c11ef fixes this issue.

I'm closing this for now. Please feel free to reopen this.