How to Implement Hazelcast to invalidate the cache for Multiple POD

I am new in Hazelcast so need help to understand

Use case

we are a running application (Apache + Dispatcher) POD in Kubernetes Cluster. we have another Running POD (Publisher). Each Apache+Dispatcher POD has it’s own Local Cache. We have Two POD running for apache and one POD Running for Publisher.

To access the application We have LoadBalancer Service for Apache and LoadBalancer Service for Publisher POD

Inside Publisher POD we have Apache+Disp Flush Agent running. whenever there is any changes on Pages on Publisher and as soon as we activate the page Flush agent gets trigger from Publisher and it calls the Apache+Disp POD to invalidate the cache.

Issue

If we use single POD for Apache+Disp cache invalidate is happening fine but as soon as we increase the POD from one to two cache invalidation is not getting equally distribute to each POD from LB service.

From Publisher it triggers the flush agent to invalidate the cache but it is not invalidating the cache on both the POD.

Please suggest how i can achieve this using hazelcast

if you use statefull sets for the apache pods you can give each of them a unique network identity you can use to flush them, while keeping the loadbalancer service for the regular traffic. That way the publisher can call the flush on each pod without having to try and push through the loadbalancer.

for more information read: StatefulSets - Kubernetes

Thanks for your suggestion let me try with it …i will get back to you if i face any issue

Thanks Jeroen … it worked fine i am able to solve the issue