kubernetes-sigs / kube-scheduler-simulator

The simulator for the Kubernetes scheduler
Apache License 2.0
798 stars 137 forks source link

how to custom plugins in the simulator #383

Open Loong435 opened 3 weeks ago

Loong435 commented 3 weeks ago

Hello, I'm currently learning how to use Kubernetes scheduling, and I'm following your tutorial on creating a custom scheduler with a simulator. I've been trying for two days but still can't achieve the expected output for the "NodeNumber" plugin, as shown in your final screenshot. Could you help me figure out where I might have gone wrong? Below are all the screenshots from my setup process and the modifications I've made.Thank you so much!

result1 result2 result3 change1 change2 change3
Loong435 commented 3 weeks ago
change4
sanposhiho commented 3 weeks ago

cc @YamasouA

sanposhiho commented 3 weeks ago

Actually, we're in the transition phase to a new way of inserting a custom plugin.

You may want to try out a new simulator/docs/debuggable-scheduler.md ("Integrate your plugins to the simulator" section) in this PR: https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/382

Loong435 commented 2 weeks ago

Hi,Thanks a lot for your response! I went through the issue you pointed out and have a couple of questions if you don’t mind.

I noticed that you’ve updated a lot of source code across different files, but it looks like those changes aren’t reflected in the main project files yet. Do you have an estimate on when those updates might be pushed?

Also, if I want to try the approach in simulator/docs/debuggable-scheduler.md, would it be best to wait until those updates are live, or should I go ahead and manually apply the changes you made across the project before testing?

Thanks again for any extra details you can share! I really appreciate the help.

sanposhiho commented 2 weeks ago

Our next release will come when https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/382 is merged, which should be very soon. I believe a new simulator/docs/debuggable-scheduler.md should work with the current latest master branch, if not, that's a bug. Some implementation changes are made in https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/382 too though, they are all about the cleanup.

Loong435 commented 3 days ago

Hi sanposhiho,

Sorry to bother you again, and thanks so much for your help so far!

I followed your new tutorial and tried to implement the custom scheduler. If I understood correctly, I replaced the contents of kubeconfig.yaml, scheduler.go, and scheduler.yaml with the example files you provided. From what I gathered, that should be enough to get the custom scheduler working.

However, I ran into some errors when running it. I've attached the modified files and the error screenshots below.

If you don’t mind, could you take a look and let me know what I might have missed? I’d really appreciate it!

Thanks again! image image image

Loong435 commented 3 days ago

I didn’t add any new files, but I don’t know why simply modifying some parts of the code causes an error saying that the kubeconfig.yaml file could not be found. Could it be that some configurations need to be adjusted, and the corresponding file needs to be mounted? Could you please help me resolve this issue?