We have a Spring Boot application deployed in an Azure Kubernetes Service (AKS). It is crucial for us to understand which pod has the leadership role. For this purpose, we use ApplicationListener from org.springframework.context in our Spring Boot application along with Apache Camel and ClusterServiceHelper from org.apache.camel.cluster.
However, we occasionally encounter an issue where the leader pod gets evicted but still retains the leadership role. When the replica set is restored, we end up with n+1 pods where one is evicted but still holds the leadership. This causes inconsistencies and potential downtime in our application.
Has anyone experienced a similar issue? How can we ensure that the evicted pod properly relinquishes its leadership role? Any advice or solutions would be greatly appreciated.
Thank you very much.