Lock object in kuberenetes

Hi, I was watching the CKA course and come across multiple scheduler video, unfortunately I did not understand what --lock-object-name does in my-custom-scheduler.

@Ayman would you please explain it?

It is used to enable leader election. Check this https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/#enable-leader-election
–lock-object-name string Define the name of the lock object. (default “kube-scheduler”) --lock- object-namespace string Define the namespace of the lock object. (default “kube-system”)

you mean when a lock object is set on a scheduler, it does not participate in election and by default / force it is elected to be master?

@Ayman please read my previous reply.

Yes, and lock-object is the name of the resource object that is used for locking during leader election.