k8s - leader election 实现
leader electionlock type 锁类型leasesendpointsleasesconfigmapsleasesleases类型实现对应的struct,leaderelection/resourcelock/leaselock/LeaseLockendpointsleases实现endpoints和leases两种方式MultiLock: 用作迁移,里面有两种场景,Primary
·
leader election
- lock type 锁类型
- leases
- endpointsleases
- configmapsleases
- leases类型实现
- 对应的struct,leaderelection/resourcelock/leaselock/LeaseLock
- endpointsleases
- 实现endpoints和leases两种方式
- MultiLock: 用作迁移,里面有两种场景,Primary、Secondary
- endpointsLock
- 通过在endpoints里面的annotation存储的LeaderElectionRecord信息,来进行选举
- annotation里面的key为control-plane.alpha.kubernetes.io/leader
- LeaderElectionRecord存储了时间、 标识
- configmapsleases
- 实现configmaps和lease两种
- MultiLock
- configmapLock
- 跟endpoints差不多
- 入口LeaderElector
- 重要的元素LeaderElectionConfig
- Lock rl.Interface
- Callbacks LeaderCallbacks
- 重要的元素LeaderElectionConfig
- 通过callback,实现业务逻辑
- OnStartedLeading:成为leader
- OnStoppedLeading:leader结束
- OnNewLeader:leader变更时
更多推荐
已为社区贡献3条内容
所有评论(0)