admin管理员组文章数量:1391960
I have an application using the Spring Cloud Kubernetes leader election mechanism. When shutting down the pod, I would like to revoke leadership before the Spring graceful shutdown starts to ensure that the leader is never shutdown. This is to avoid that the instance is shutdown while the leader is doing one of its tasks.
For that, I added a preStop hook which is executed when the pod starts shutting down and before the Spring graceful shutdown is started. But I have observed that sometimes the leadership is granted to the same pod. Is there a way to avoid that?
I have added an internal flag to make the application aware the shutdown is in progress, so if the leadership is granted again, I can avoid to do any leader-related operation. With this what Im implementing is that the leader stops doing its tasks before shutting down, but even though this solves my original problem, its not exactly what I was trying to implement on first place.
Thanks in advance!
本文标签: Avoid leadership grant on shutdown (Spring Cloud Kubernetes)Stack Overflow
版权声明:本文标题:Avoid leadership grant on shutdown (Spring Cloud Kubernetes) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744757751a2623565.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论