简体   繁体   中英

Kubernetes CalculateNodeLabelPriority does not work

I need to prioritize pod creation on nodes according a given node label. I used CalculateNodeLabelPriority to enforce the rules I need. However when I start the kube-scheduler I get following error

F0217 10:52:18.020751    3198 plugins.go:198] Invalid configuration: Priority type not found for CalculateNodeLabelPriority

I looked at master and I can see that CalculateNodeLabelPriority priority is not registered in the defaultPriorities

https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go

Why isn't it registered although is mentioned in priorities.go? Is there a way I can register it?

Managed to fix the issue by adding a argument variable. Code checks for the argument object in order to accept the Priority object https://github.com/kubernetes/kubernetes/blob/release-1.1/plugin/pkg/scheduler/factory/plugins.go#L98

{
   "predicates": [
     {
        "name": "HostName"
     },
     {
        "name": "MatchNodeSelector"
     },
     {
        "name": "PodFitsResources"
     }
   ],
   "priorities": [
     {
        "name": "NewNodeLabelPriority",
        "weight": 1,
        "argument": {
           "labelPreference": {
               "label": "pdc",
               "presence": true
           }
        }
     }
   ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM