Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to custom plugins in the simulator #383

Open
Loong435 opened this issue Nov 6, 2024 · 11 comments
Open

how to custom plugins in the simulator #383

Loong435 opened this issue Nov 6, 2024 · 11 comments
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@Loong435
Copy link

Loong435 commented Nov 6, 2024

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
Copy link
Author

Loong435 commented Nov 6, 2024

change4

@sanposhiho sanposhiho added the kind/support Categorizes issue or PR as a support question. label Nov 7, 2024
@sanposhiho
Copy link
Member

cc @YamasouA

@sanposhiho
Copy link
Member

sanposhiho commented Nov 7, 2024

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: #382

@Loong435
Copy link
Author

Loong435 commented Nov 8, 2024

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
Copy link
Member

Our next release will come when #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 #382 too though, they are all about the cleanup.

@Loong435
Copy link
Author

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
Copy link
Author

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?

@sanposhiho
Copy link
Member

I rechecked on my side but the doc perfectly worked for me. I suspect that you did something that wan't on the doc, which caused the issue.

@sanposhiho
Copy link
Member

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.

Why did you need to change kubeconfig and scheduler config?

@Loong435
Copy link
Author

Loong435 commented Dec 4, 2024

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.

Why did you need to change kubeconfig and scheduler config?

Thank you for your response. I modified the configuration file because I noticed that the file names in the /debuggable-scheduler/ directory were identical to those in the simulator/cmd/scheduler/ directory in your example. I thought I needed to replace everything inside.
Thank you for your response. I modified the configuration file because I noticed that the file names in the /debuggable-scheduler/ directory were identical to those in the simulator/cmd/scheduler/ directory in your example. I thought I needed to replace everything inside.
command, cancelFn, err := debuggablescheduler.NewSchedulerCommand()
with:
command, cancelFn, err := debuggablescheduler.NewSchedulerCommand(
debuggablescheduler.WithPlugin(nodenumber.Name, nodenumber.New), // Register the custom scheduler plugin.
debuggablescheduler.WithPluginExtenders(noderesources.Name, extender.New) // [Optional] Register the extender plugin
)
The program runs without errors, but I can’t see any changes in the web UI. Could you please help me understand why this might be happening? I really appreciate your help with this simple question, and I’d be extremely grateful if you could assist me further.
The configuration environment information for the Web UI after running Docker is as follows:
kind: KubeSchedulerConfiguration
apiVersion: kubescheduler.config.k8s.io/v1
parallelism: 16
leaderElection:
leaderElect: true
leaseDuration: 15s
renewDeadline: 10s
retryPeriod: 2s
resourceLock: leases
resourceName: kube-scheduler
resourceNamespace: kube-system
clientConnection:
kubeconfig: ''
acceptContentTypes: ''
contentType: application/vnd.kubernetes.protobuf
qps: 50
burst: 100
enableProfiling: true
enableContentionProfiling: true
percentageOfNodesToScore: 0
podInitialBackoffSeconds: 1
podMaxBackoffSeconds: 10
profiles:

  • schedulerName: default-scheduler
    plugins:
    preEnqueue: {}
    queueSort: {}
    preFilter: {}
    filter: {}
    postFilter: {}
    preScore: {}
    score: {}
    reserve: {}
    permit: {}
    preBind: {}
    bind: {}
    postBind: {}
    multiPoint:
    enabled:
    - name: SchedulingGates
    - name: PrioritySort
    - name: NodeUnschedulable
    - name: NodeName
    - name: TaintToleration
    weight: 3
    - name: NodeAffinity
    weight: 2
    - name: NodePorts
    - name: NodeResourcesFit
    weight: 1
    - name: VolumeRestrictions
    - name: EBSLimits
    - name: GCEPDLimits
    - name: NodeVolumeLimits
    - name: AzureDiskLimits
    - name: VolumeBinding
    - name: VolumeZone
    - name: PodTopologySpread
    weight: 2
    - name: InterPodAffinity
    weight: 2
    - name: DefaultPreemption
    - name: NodeResourcesBalancedAllocation
    weight: 1
    - name: ImageLocality
    weight: 1
    - name: DefaultBinder
    pluginConfig:
    • name: DefaultPreemption
      args:
      kind: DefaultPreemptionArgs
      apiVersion: kubescheduler.config.k8s.io/v1
      minCandidateNodesPercentage: 10
      minCandidateNodesAbsolute: 100
    • name: InterPodAffinity
      args:
      kind: InterPodAffinityArgs
      apiVersion: kubescheduler.config.k8s.io/v1
      hardPodAffinityWeight: 1
      ignorePreferredTermsOfExistingPods: false
    • name: NodeAffinity
      args:
      kind: NodeAffinityArgs
      apiVersion: kubescheduler.config.k8s.io/v1
    • name: NodeResourcesBalancedAllocation
      args:
      kind: NodeResourcesBalancedAllocationArgs
      apiVersion: kubescheduler.config.k8s.io/v1
      resources:
      - name: cpu
      weight: 1
      - name: memory
      weight: 1
    • name: NodeResourcesFit
      args:
      kind: NodeResourcesFitArgs
      apiVersion: kubescheduler.config.k8s.io/v1
      scoringStrategy:
      type: LeastAllocated
      resources:
      - name: cpu
      weight: 1
      - name: memory
      weight: 1
    • name: PodTopologySpread
      args:
      kind: PodTopologySpreadArgs
      apiVersion: kubescheduler.config.k8s.io/v1
      defaultingType: System
    • name: VolumeBinding
      args:
      kind: VolumeBindingArgs
      apiVersion: kubescheduler.config.k8s.io/v1
      bindTimeoutSeconds: 600

@sanposhiho
Copy link
Member

The program runs without errors, but I can’t see any changes in the web UI.

It's unclear what is the problem.
Please explain the problem you're facing and provide the simple process to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

2 participants