Okabe-Rintarou-0 / Kube-Sample-Scheduler

An example of custom kube-scheduler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My Sample Scheduler

An example of Kubernetes custom scheduler.

lifecycle

Steps to Run

Environment: Ubuntu 20.04, Kubernetes v1.22.2, Docker 24.0.5, go 1.21.4

  • Build the custom scheduler image:

    docker build -t scheduler .
  • Apply your scheduler

    kubectl apply -f scheduler.yml
  • Create a pod to test

    kubectl apply -f test.yml

Reference

  • https://blog.wubw.fun/2021/12/build-kubernetes-scheduler-framework-plugin.html Describe a good way to solve k8s dependency problems.

    kubernetes在设计上会独立发布各个模块,并对外屏蔽部分不稳定的代码,避免主仓库作为一个整体被外部引用,所以将部分模块的依赖版本写成了v0.0.0,然后再用replace替换成了代码仓库里的相对路径,即staging目录里的独立模块。如此一来,直接使用kubernetes代码是没问题的,但是使用go get或者go mod去获取kubernetes主仓库作为依赖时会遇到诸如此类的错误:k8s.io/api@v0.0.0: reading k8s.io/api/go.mod at revision v0.0.0: unknown revision

  • Official example: https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/

    This step matters: clusterrole

About

An example of custom kube-scheduler.


Languages

Language:Go 70.1%Language:Shell 23.2%Language:Dockerfile 6.7%